Reading qDebug output of Apps on ios devices from command line - ios

I am currently working on automated testing of Qt-Applications on devices running iOS. So far I am able to install and run these Applications fine, but I am unable to read their output. As far as I understood, reading this issue, Qt uses the gdb server to deliver the output of std::out and std::err to the Qt Creator but I can not get my head around on how to use this information. Besides the bundle identifier, I am given the .ipa-file of the application only. I have access to the applications code but I must not change it.
I use the libmobiledevice libraries to handle all tasks like connection, installation and execution of and on the device.
To summarize: I want to read the debug output of a Qt-written application displayed on my console, like it would be in the "Application output" window of my Creator.

I found a way using the imobiledevice libraries. By calling Idevicedebug -u <uuid> run de.foo.app I was able to execute the application. The qDebug output was prompted to std::out.
As the app crashed when started with a locked screen, I had to check for the display being idle by examining the output of idevicediagnostics ioreg IOPower first.

Now, half a year later, I found a solution that worked both elegant and stable.
I installed the ios-deploy tool using node:
npm install -g ios-deploy
Using this, I was able to install the app and listen to it's output via:
ios-deploy --debug --bundle path/to/my.app
I recieved the full qDebug, std::out and std::err output perfectly fine.
To uninstall the app, I simply added the -9 or --uninstall_only option:
ios-deploy --debug --bundle path/to/my.app --uninstall_only
Using this solution the app could be started reliably, without crashing with a locked screen

Related

Calabash-ios: Run test physical device installed ipa without xcodeproj

I am new with calabash-ios and have a dummy question is:
How possibly could I run a calabash test with real device which have installed ipa file (included calabash framework) and without xcodeproj?
Problem is I am doing QA and Dev only gives me ipa file to test without source code.
UPDATE:
I am able to run the ipa file in console and cucumber by adding BUNDLE_ID. And make sure the CFNetwork.framework is including in app framework to establish the connection.
But I got another problem to run the scenario:
1. When I run the command below:
DEVICE_ENDPOINT=http://192.168.1.9:37265 NO_LAUNCH=1 BUNDLE_ID=com.example.appname DEVICE_TARGET=UDID cucumber
Then I got this error:
A JSON text must at least contain two octets! (JSON::ParserError)
features/my_first.feature:8:in `Then I touch "LOG-IN/ CREATE ACCOUNT"'
all other steps was skipped
Then I run the console code
DEVICE_ENDPOINT=http://192.168.1.9:37265 NO_LAUNCH=1 BUNDLE_ID=com.example.appname DEVICE_TARGET=UDID calabash-ios console
Then I run server_version
I got reply back that said connection SUCCEED
But when I run start_test_server_in_background
It took me too long to wait and I see the app my physical device kept crashed and launch again and again until it stop as:
Unable to start. Make sure you've set APP_BUNDLE_PATH to a build supported by this simulator version
Calabash::Cucumber::Launcher::StartError: Calabash::Cucumber::Launcher::StartError:
"Timed out waiting for UIAutomation run-loop Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError.
2015-10-01 10:49:41.634 instruments[15640:10558880] WebKit Threading Violation - initial use of WebKit from a secondary thread.
2015-10-01 10:49:42.574 instruments[15640:10558978] Attempting to change event horizon while disengage
2015-10-01 10:49:42.577 instruments[15640:10558877] Attempting to change event horizon while disengage
Instruments Trace Error : Target failed to run: Permission to debug app
Anyone can help please! I tried to search some solution but they almost issue on simulator and they contain xcodeproj. As a QA, I dont have the source code, only .ipa file. :(
Thanks
You should set 3 variables:
$ DEVICE_TARGET=<UDID> \
DEVICE_ENDPOINT=http://<ip>:37265 \
BUNDLE_ID=com.example.YourApp cucumber
The device and the host computer should be on the same network.
The .ipa must be installed on your device.
You can do this in Xcode by dragging-and-dropping in the Device Manager window or with a third-party tool like ideviceinstaller (available with homebrew).
You should never set NO_LAUNCH.
http://calabashapi.xamarin.com/ios/file.ENVIRONMENT_VARIABLES.html#label-NO_LAUNCH
You also need to enable you device for develop and turn on UIAutomation in the Settings.app > Developer.
Enabling device for development
RunLoop::Fifo::NoReaderConfiguredError
UPDATE In response to this question, I rewrote the Testing on Physical Devices Calabash iOS wiki page. Wow, that content was ancient!
As long as the file is build with calabash then that is not a problem. You just call cucumber with APP_BUNDLE_PATH to where ever your .ipa file is and should be all set.
But you should be aware that .ipa needs to be build to match the target you run the tests on.

Reset iOS app from commandline

I'm building a tool for building an iOS app and running UIAutomation on it. So far I've been targeting the iOS Simulator and I've run into a hiccup moving to running on real devices.
I have a feature where the tool reinstalls the app between each test, so that it always runs from an uninitialized and known state, which currently uses xcrun simctl uninstall and obviously doesn't work for real devices. I'm looking for something similar for real iOS devices.
Another working solution would be to reset the app through some nifty command.
I'm not interested in any UI based solutions, it has to run from a commandline.
iDeviceInstaller supports uninstalling/installing on real devices.
Uninstall:
/usr/local/bin/ideviceinstaller -U <app_bundleID> -u <device_UDID>
Install:
/usr/local/bin/ideviceinstaller -i <pathToIPA> -u <device_UDID>
We wrote an automation bridge in Illuminator that should allow you to send arbitrary commands to your application (in both the simulator and on real hardware).
It is accessed via the command line through a ruby script.

How do you run DalekJS on iOS?

I've got DalekJS running really well on WinLin, but am interested to know exactly what the process is for running it on iOS.
http://dalekjs.com/docs/ios.html
When running on Windows, for example, I install the DalekJS npm globally, and then install the IE web-driver, before executing my test suite.
On iOS am I expected to do the same thing? Can you install NodeJS on an iPhone? Is there a difference in doing it on the actual device, vs doing it through the emulator?
Also, what are the current obstacles in making it run on iPad?
Thanks!
Dalek will not run on the IPad/Iphone etc. itself (neither will or must NodeJS), it uses the native debugging tools that come with the dev environment through Appium.
Unfortunately, due to some changes that happened in MacOS 10.8 & 10.9 (Changes in the user rights management, etc.) it can only do this in the simulator. We are working on bringing back support for "real" devices with the next version of DalekJS.

Platform ios already installed

I'm tryin' to debug my app on iOS simulator in my Mac.
I've followed all the instructions installing on my Mac:
sudo npm install -g vs-mda-remote
sudo npm install -g ios-sim
When I prompted
vs-mda-remote --buildDir Projects
(Projects is the folder where debug files will be droped), I see results in my PC by
http://<MAc_IP>:3000
With the following text
Remote build Express server open for business on port 3000
Ok, now I prompted
vs-mda-remote test
And I see an error with the following message
Failed to build app: CordovaError: Platform ios already added
I don't know what happen.
Ok, I found the problem. Maybe, I'm too eagier.
Instead of using one session in terminal app on mac, I used too many, so, when I prompted too many timesvs-mda-remote, obviously ios was already installed.
So, opening terminal at first time, and prompting
vs-mda-remote --buildDir Projects --allowsEmulate=true
Now, I can debug on iOS simulator from my PC to Mac.
While running the build agent, the correct command is:
vs-mda-remote --buildDir <server-build-directory> --allowsEmulate=true
Note the last "--allowsEmulate=true" part of the command.
*Taken from "Setting up the Remote Agent to Support Starting the iOS Simulator" section in the documentation.
Platform ios already installed
Received this error for running in device too, while running multiple instance in mac.
Quit Terminal and run single instance for vs-mda-remote to resolve this problem if you receive this error for running in Device.

simple kivy application not running on android?

i'm trying to run kivy examples on my android emulator, i can build them and install them on my device without any problem but i can't start them. does anybody have this problem too?
i'm using android API 18 as target.
You can run adb logcat, then try to start your app. After it crashes, you can ctrl+c to stop logcat and search for "died". Your error should be shown a few lines before it says your app died.
First thing, I'm not clear...is your problem with an emulator or a device? Or you have different problems on each?
If it's an emulator, make sure you are using a recent android version (I think you need at least 4.1 or something), and it must have hardware acceleration enabled for kivy to work.
Either way, if the app installs but fails to start, that suggests something is crashing it at the initialisation stage. You should plug your device into your computer, enable adb in its developer options, and run adb logcat to see the device log in real time. Run your application, and you will see the initialisation log and any standard python log when the app fails. This should indicate the problem.
The adb tool comes with the android sdk, so you must have it if you built an apk, but you might need to find it manually somewhere in the sdk folder if it isn't already somewhere in your $PATH.
I have same issue in past and I solve by adding requirements in .spec
This requirements work for me:
requirements = hostpython3==3.7.8,python3==3.7.8,kivy==1.11.1, certifi,chardet, lxml, docutils, future, idna, Kivy-Garden, Pygments, requests, six, soupsieve, urllib3, deep-translator, arabic-reshaper, python-bidi, openssl, pyopenssl, numpy, pytz, python-dateutil, pandas, setuptools, zope.interface, datetime
you have to write all modules and parent module in requirements which your app is using.
To know module which you app is using has two method:
run command pip freeze in current app folder in powershell
install all the module as below photo which help to install your application module

Resources