Instrumentation Test not starting on Android only on a real device. Working on Simulator - react-native

I am mainly facing an issue with running detox tests on android real device. The main problem I face is that await device.launchApp() just doesn't launch the app. After adding some log traces I see that android instrumentation command is the one that is not actually starting the app. Detox internally calls the command /Users/<uname>/Library/Android/sdk/platform-tools/adb -s 39bc3158 shell am instrument -w -r -e detoxServer ws://localhost:51414 -e detoxSessionId 5c04ed58-aa77-64bb-aa2b-3a008f21ac2b -e debug false com.realapp.app.test/androidx.test.runner.AndroidJUnitRunner. This command hangs and Process Times out after sometime and doesn't launch the app.
If I create an instrumentation test from android studio also I am seeing the same issue and this problem only occurs on a real device and not on a simulator. Simulator works absolutely fine and the test cases run smooth.
I have looked into different issues, used 4.1.2 android studio, Invalidated cached and restarted upgraded to latest beta android studio and nothing seems to help.
Also the instrumentation tests run fine on the real device if i open the app manually after starting the tests. The tests are just not launching the app automatically.

Related

Detox build command fails in Github jobs

Running build test for ios release locally is working fine, however it fails on Github actions enter image description here
It seems like your app build command (that you have provided in Detox config) is faulty and that is why your app is failing build. Unrelated to Detox.

Automate Xcode Simulator: how to build and launch an app from terminal

Is there a way to build an application for the iPhone, and have it running in the simulator, but using just the console?
I am trying to test an app, that will launch; send some data and then quit; if I run it via Xcode, it works fine; the simulator launch and everything is good.
But using xcodebuild; the app build but won't launch the simulator.
Is there any command or flag to do what Xcode IDE does, but using xcodebuild?
I have found an undocumented flag for the simulator, which is called "SimulateApplication", but sadly the usage is not documented; which makes it a bit hard to use.
Tried with ios-sim but my project won't work with it.
One way is to use instruments. In a way, you'll run it under "UI automation", but you don't actually automate the UI at all. The steps are:
Compile the app:
xcodebuild -sdk iphonesimulator7.1
Create a dummy UI automation script that does nothing (myscript.js):
while(true) {
UIATarget.localTarget().delay(100);
}
Then run the app via instruments:
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate "$(pwd)/$(find . -name '*.app' | grep iphonesimulator)" -e UIASCRIPT myscript.js
(The find | grep monster there just translates to the full path of the compiled version of the app. You are of course free to type it manually as well if you so prefer.)

Simulator not running XCTest tests

I am new to running unit tests in Xcode (with XCText). I created an empty iOS application and just tried running the tests (which should fail by default). The iOS simulator starts and the toolbar console just shows "testing..." and it just hangs forever. I don't see any error in the console. If I try running the tests on a device (iPhone 5 in my case), the tests run just fine.
I am using Xcode 5.1.1 and simulator 7.1
Any idea on what could be causing this?

Cannot Install into iPhone Simulator

I've got an Xcode project that I've been working on over the past few weeks.
I just made some changes to an embedded framework that I'm working on (recompiled, to be specific) now, however, I am unable to launch the application in the simulator.
The app hangs on "Attaching to [app name]," if I have a debugger on. If I don't have a debugger on, Xcode just says the app has finished running.
There is no icon installed on the device.
Here's what I've done so far:
Restarted
Reset simulator
Clean and build
Deleted derrived data
I cannot install onto a device either, but then I get an error:
Error launching remote program: No such file or directory (/Users/peter/Library/Developer/Xcode/DerivedData/x-gtwuuwmavjonyrcxjmpcletdpyjw/Build/Products/Debug-iphoneos/x.app/x).
Oddly enough, what worked was installing another app in the sim (just launched another project and ran it) and then launching the other app in the sim.
I'm not sure what the issue was, but I tried it on two computers and it was hanging on each, so it was related to the project rather than the simulator. There's an issue to think about...

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...