Is it possible to add UI test target with default test class programatically in Xcode? - import

Upon creating a UI target to the app two files will be created in Xcode.
MyAppUITests.swift and info.plist
These both files are placed under the MyAppUITests folder.
The swift class has some default test methods to starts with whereas the plist has the settings info of the created UI test. We are then write test cases, write some utility classes etc. The utility classes also saved under the UI test target. The whole setup works fine with "MyApp".
Requirement: I want to give this setup to some other tester/developer who is a newbie. Means, if they want to implement the UI testing in their app, I want to give them a sample setup which will contain the UI test target with some sample test cases and utility methods.
Current flow: Currently we are having documents regarding the UI test setup, the usage of the written utilities, etc. A person can read those documents and do all the steps manually to setup the UI test environment.
We want to take it to the next level by automate this setup process. Something like, if I keep the sample files in a repo and create a run script that can import the files from repo and add it to the newbie's source code while running. I'm not sure this is possible and I appreciate the suggestions on it.

You should probably do the generic preparation by yourself. Then, with the help of git write a bash script that does this preparation. I suppose you can automate some of the most difficult to automate steps with xcodeproj generators like
https://github.com/yonaskolb/XcodeGen

Related

Can you export/import MochaJS tests from test files meant for unit tests for use in separate, higher level integration test files?

I'm trying to design a hierarchy integration test structure for a complex application. Essentially I'm looking to do something like the following:
..admin/workflow/user_role/pages/component
The component directory is used for the unit tests, but id like to be able to import these unit tests in to an integration test file in pages directory. From there, i'd like to be able to import that integration test up the tree, so on and so forth.
Is it possible to export, import, and reference MochaJS tests from other files similar to how we would export things in other JavaScript frameworks? I am just trying to save myself from having to copy and paste each new test I implement in to the entire structure I am designing.
Thanks in advance!
I have yet to try this as it will take a great amount of time to implement this fully, so I am just curious as to if this is even a possibility. I have looked in the MochaJS documentation but I'm either missing it or it's not referenced anywhere.

Does Next.js have plugins?

Imagine you want to produce a specific static asset for your Next.js web app. An image collage for example, or perhaps a web manifest or site map.
My current strategy for this kind of scenario is to make a script that can produce the desired output directly in my /public folder, but then I have to push the built file along with my source files in my repo, which is less than ideal.
Or, I have to set up a separate parallel asset pipeline to re-create the asset when the source files change and which I would launch whenever I launch next dev. I would also need to run the script when next build is called.
In either case, I then also need to ignore the built file so it's not pushed along with the other files in /public…
This kind of solution feels like I'm reinventing the wheel and losing the zero-config ideal around which the Next.js ecosystem revolves.
I'd much rather provide Next.js with my custom script and just hook into the existing asset pipeline, dev server lifecycle, and build script, letting Next.js do the heavy lifting for me, hence my question:
Does Next.js have a plugin architecture, extensions, or perhaps lifecycle hooks I could tap into to implement a custom asset pipeline?
I see some pluggable loaders exist for Next.js, such as the MDX loader, but it's not clear to me whether this is the way to go for what I'm trying to do, and I'm not finding any documentation about how to write my own loader, so I'm afraid this might not be a recommended approach…

Running feature file will trigger #before in different steps class but in the same package

I am still very new in Cucumber-jvm/Selenium, so I am very sorry if the question sounds dumb.
My question is, if I run a feature file as a cucumber feature, do it run #before in different steps file because it search all the steps. If it does then how to make it just run the step I want? I can change the location of the glue code but is that the only solution?
Background: I'm an intern in a big company. I'm doing an automated software testing for a product. There is already an existing automated test steps. What we're going to do is to extend the project and add our own steps. I created a new simple steps class and feature file just to try it out. It doesn't work because every time I run the feature file, it triggers something which I presume #before in different steps. The #before is in every existing steps in the package. The thing work if I change package and do run configuration which I add the location of the glue code. I'm using Eclipse Photon.
Stepdefs and hook methods are global in nature ie. if they are present in the packages defined in the glue option of the runner they will be picked up for each scenario. The way out is to use tags on the hooks which match that on the scenario.
SOmething like
#Before("#TagNew")
#TagNew
Scenario:....

Making an app engine to use for similar app, but with different clients

Our team has made a big app. This app has been a success with previous client.
Now other clients will be using this app, but with added requirements and/or different needs.
I would like to focus on making the current app into a generic Engine so that we can maintain this engine up-to-date across those different client-apps.
How should I:
Tackle this?
Bearing in mind that some viewControllers will need to reflect for new client
Changing all the graphics across the app
Any hint of how I can achieve? Been googling since long, could not arrive at a decent solution.
I already did something similar in the past, here is how we did:
part 1A: create a template project using demo assets (images has to have a default names ex:background_home.png).
part 1B: make sure that "special texts" are loaded from a plist (example:[HOME_TITLE:"your title"]) in this way you will be able to load customizable texts from a plist in the app bundle programmatically.
part 2: ask your designer to make a special design for the client respecting the name used by the developers in the code (ex:part 1A => background_home.png) or ask your designer to generate more or less 20 themes.
part 3: make a MACOS app or a script which will copy the original project and replace demo assets and plist by the correct one in the original project. You want the script to generate an xcode project as you will need to double check with your developer team that the project is properly setted-up, build and deployment is much easier when you have an xcode project. In other words, the script just take the folder of the original project your team made and replace some file inside. So you won't struggle with xcode project architecture, you just replace defaults assets. Also remember that storyboard files or pbxproj are xml so you can parse and edit them, but you might have some headache doing this, that's why I recommand you to just modify the assets in the project folder.
Then you can compile that project, configure it with the provisioning you want and deploy it to your clients. Thats what we did when we needed and it worked like a charm. Basically we made a MACOS app that the sale's force could use directly with the client. They just had to send to the developer team the generated xcode project in a zip and we were in charge of the compilation and deployment. We "developed" more than 600 products using that trick.
PROBLEMS:
- The code was fully visible in the xcode project and anybody could read and/or steal it.
- The projects were very similar to each others as they came from the same source code, only the texts and assets were differents.
WORKAROUND-SOLUTIONS:
- You can imagine implementing crypto when saving the archive of a project, in this way only authorized personal can unzip the archive containing the source code.
- You can create multiple projects and do the same process with different types of project. In this way you can change the type of a generated project according to client wishes ...
Hope this help!

Is it possible to hide the source codes of .m files and build project using xcodebuild

I have created a Mac app that can generate iphone ebook app project source codes.
I know I can using xcodebuild to build the project to get the release binary file.
Is it possible to hide the source codes of .m files(maybe store in memory) and build project using xcodebuild?
Welcome any comment
Thanks
Marc
It sounds to me like you are attempting to generate source code for others to use, but then hide it so they cannot see whats been generated. Basically not possible. You could generate obfuscated code which would make it harder to read, but not impossible.
Realistically what you are trying to do is generate template code for others to use. If you don't want them to be able to see it, then you presumably don't want them modifying it. The easiest answer is to simple not do it. Instead, create a compile static framework containing your code and IP, and then only generate templates which makes calls to your framework. Thus your code is protected.
Your question lives on the edge of being programming related, and I'm not exactly sure what problem you're trying to solve.
However, you can create a RAM disk, store your project there and run xcodebuild against that. Just be aware that you're not really protecting the .m files so much as limiting how long they are easily visible.