iOS code coverage for UIAutomation functional tests - ios-ui-automation

I want to generate the code coverage files for our iOS App.
The problem is that when I build the code with the test coverage settings it builds and then the Simulator launches the App. Now I want to run my UIAutomation functional tests, but as soon as I kick off my tests using the instruments command, the Simulator restarts!
For code coverage files to be generated, the App must not restart.
Has anybody found a way yet to use the already running simulator to execute the UIAutomation tests?

You may be able to find some ideas from this previous question
Is there any way to test the code coverage of UIAutomation tests?

Related

How is detox code inserted into the app bundle

I use detox to run e2e tests on react native.
This artcile written by one of the people working on detox says
Gray box essentially uses a piece of code that is planted in the app, it can help us see what’s going on inside.
My question is, how does that happen? Looking at the docs the command used for detox build is
xcodebuild -project ios/YourProject.xcodeproj -scheme YourProject -sdk iphonesimulator -derivedDataPath ios/build
No detox-specific mention to be seen there.
Also, the docs state here that the build command is optional and that
You can also choose not to use it and provide a compiled app by yourself.
Well, how do I do that? How do I inject detox / make sure detox is not injected into my app? If I download compiled app from my CI server it does not work with detox (not surprisingly since the detox code is not planted into the app). But if I use the detox build command (which seem to just run whatever the build command in the config specifies), the tests work. There seems to be some "magic" happening which is not understandable for a newcomer.
Thanks.
It's magic!
Well, actually it isn't. The build step is completely optional, and as stated in the documentation, Detox works with any valid app.
In order to load Detox, we tell the dynamic linker to load it using the DYLD_INSERT_LIBRARIES environment variable. So it only loads Detox when you run detox test from the command line.
This is easy on the simulator as it has access to your Mac's file system. Once we implement support for testing on actual hardware devices, we will still use that environment variable, but we will have to inject it inside your IPA file directly.

Calabash Automation Testing

I am new in Automating the apps for testing Android and i like to advance to this level... I have researched for Appium and Calabash... but knowing the difference pretty complicated.. There are my questions:
1: For Calabash, do we need the source code, i mean can i have APK and give test cases and so on? or do I NEED the source code even if im using the elements from app?
2: I heard i can use the Appium with cucumber, and same question do i need source code for that?
I have researched about it and all i get is for Apple apps... but nothing much for android...
You don't need source code. All you need is apk file, packageName and ActivityName to launch the app.
In Appium framework, all you need is app file (for android it will be simply .apk file).
Source code will be never needed, all elements from UI that you would like to interact with, can be simply get from Appium Inspector.
For both calabash and Appium you don't need to source code. you can automate application using apk file.
Yes you can use Appium with cucumber.
To find object locators of application use calabash console and Android UI Viewer, Appium GUI.

Running XCTest on iphone device

I am trying to run XCTest on iphone device but Xcode show be following message.
"Logic Testing on iOS devices is not supported. You can run logic tests on the Simulator." 
Is there any way by which I can run the XCTest on device?
Thanks,
Dev
Ok. I found that using GHUnit we can run unit tests on iphone device. Internally it uses xctest. Here is how you setup GHUnit.
I was able to follow the instructions and setup unit tests using xcode 5.

Can Xcode's OCUnit tests run on iOS device rather than simulator

I am trying to run OCUnit tests using my iPad but find that Xcode (version 4.3.3) always
gives the message Test Succeeded even if the test actually failed - i.e. the debug console logs the test as failed. If I run exactly the same tests but using the simulator the tests fail as I would expect.
For example I created a new project with the following test:
- (void)testExample
{
STFail(#"This test should fail");
}
When I ran it on iPad Xcode gave the Test Succeeded message:
When I ran it on the simulator Xcode gave me the Test Failed message:
Is it possible to get a Test Failed message running this on an iOS device?
Thank you!
The SenTesting framework is not complete and it does not guarantee to work with devices, But it does work fine with the simulator. In order to run unit test on your device, I recommend you to use this library,
GHUnit
Im not sure exactly what your asking, but the simulator works exactly the same. So be sure to keep the device plugged in to the computer when you are doing these tests. Yes you really do need to rephrase your question, i will be back when you do so.

Testing BlackBerry code without starting the device simulator

In Eclipse, I want to test some java microedition network code -- javax.microedition.io.HttpConnection -- to see if the network connection is successful and get some cookie values. But running this code using a JRE on my development machine doesn't execute the method, unless I launch and test using a simulator.
Can I run BlackBerry code using a desktop JRE or will I always have to test using a simulator?
I've never heard of a way of running BB code without running the simulator. You can set a program to automatically start the simulator and "click" some buttons so you can run tests automatically, but I don't think this is what you're looking for...