I am trying to open appium, avd, and ride to run a test in Jeninks. I have the following in execute windows batch command:
C:
cd C:\Users\Gebruiker
appium
adb start-server
cd C:\Users\Gebruiker\AppData\Local\Android\Sdk\emulator
emulator -avd Pixel_3_API_23
ride.py
D:
cd D:\RIDE - testproject\Avans-One
robot -d Open_settings_connect_wifi AvansOne
It keeps loading after opening Appium, the first step. I have tried seperating the steps but it still doesnt work. It completes the first step and then just keeps loading. How do i fix this?
Most probably, this is happening because the command used to start the app is not returning while the app is running. So you will have to use a command that allows you to run the application in the background.
Check with something like below.
START /B title program
e.g.:
C:
cd C:\Users\Gebruiker
START /B "" appium
You can read more about the background process here
Related
Running all tests (works)
When I run all tests inside PhpStorm, then I go to "Run" >> "MyProject PhpUnit Test". This outputs and runs a command like this:
[docker-compose://[/path/to/my/project/docker-compose.yml]:php/]:/usr/local/bin/php /var/www/docroot/bin/phpunit --configuration /var/www/docroot/phpunit.xml.dist --teamcity
That runs all tests inside PhpStorm, so far so good!
Running single test (does not work)
If I go to a single test, right-click on the test-name and click:
"Run testAppendShortToAnswers..."
Shortcut: CTRLShiftR
then it outputs and runs a command like this:
[docker-compose://[/path/to/my/project/docker-compose.yml]:php/]:/usr/local/bin/php /var/www/docroot/bin/phpunit --configuration /var/www/docroot/phpunit.xml.dist --filter "/(App\\Tests\\Entity\\CardTest::testAppendShortToAnswers)( .*)?$/" --test-suffix CardTest.php /path/to/my/project/tests/Entity --teamcity
And throws an error immediately:
Cannot open file "/path/to/my/project/tests/Entity.php".
Process finished with exit code 1
I'm assuming that it's because it tries to access that file, not from inside my Docker-container, but rather from my host-machine.
How do I fix this, so I can run a single test in PhpStorm?
Info about the setup
I struggled a bit setting up PhpStorm to run the tests, but you can see the big problem I had (and the solution) alongside links and whatnot here.
I'm on a Mac. It's a Symfony-project, where PhpUnit is located in a folder in the project-root (/bin/phpunit). So it's not installed via Composer.
I'm not really sure why it's setup this way.
Solution attempt 1: Running single test from the terminal
If I go to the terminal and run this command:
docker-compose exec php /usr/local/bin/php /var/www/docroot/bin/phpunit --filter testAppendShortToAnswers
The it runs as it should. Hmm... But I ideally I would like to run it straight from PhpStorm, so I can utilize the CTRLShiftR-shortcut.
#LazyOne pointed me in the right direction.
It was because I had a path mapping setup incorrectly.
So by changing that, then it works now:
I had it like this:
/Users/MYUSERNAME/Code/MYPROJECTNAME/some-wrong-project -> /var/www/docroot
And it fixed it to change it to:
/Users/MYUSERNAME/Code/MYPROJECTNAME/the-project-I-am-working-on -> /var/www/docroot
I want to make my app Device owner using Device policy manager for which I need to execute following command:
adb shell dpm set-device-owner {package_name}/{receiver_name}
This works find when emulator is running, and this command is hit from command line.
But I want to execute this programmatically, which I tried this way:
Java.Lang.Process process = Runtime.GetRuntime().Exec(command);
process.WaitFor();
But this doesn't work. As per the docs, I found a method ExecuteShellCommand under UiAutomation, but not sure how to use this method. Can anyone pls help?
The interesting part is how your command is defined.
Based on this answer I got the following working
Java.Lang.Process process = Runtime.GetRuntime()?.Exec(new string[] { "su", "-c", "echo test"});
var result = process?.WaitFor();
Debug.WriteLine(result);
where echo test is you actual command and su -c means substitute user and run the following command.
I've got an ant target ant server that runs a Java application which logs to the console. I need to run a new ant target ant server-gui which also logs to the console. But when I run ant server the logging prevents me from running any new ant targets.
When I enter ^c (which is the only way I know of to get out of situations like that) it kills the Java application. I need both to run. What keystroke will get me out of that "input" mode and able to run new terminal commands?
UPDATE: I haven't found a direct solution to getting out of that mode I mentioned, but opening a new tab/window in terminal does the trick. I can run as many any commands as I'd like that way. Still looking for a good solution to get out the "input" mode, though!
UPDATE 2: #abcdef pointed out another post that has an even more elegant solution.
There are a few ways to do this, assuming you are on *nix
1) Run the ant command with a & at the end to tell *nix to run the command in the background
2) Run the command with nohup at the beginning (https://en.wikipedia.org/wiki/Nohup)
3) when the process is running press ctrl-z then enter the command bg. This manually forces the command to run in the background
I hope this helps you out
I have written a UI automation script in Instruments and Its working perfectly. Now I want to know is there any way that I simply double click on script and Its start working or at least I don't need to run Xcode for running the script.
instruments -w 1.device_id -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate 2.application -e UIASCRIPT 3.script -e UI-ARESULTSPATH 4.results path
The ones marked with 1. 2. 3. 4. are the variables that you type. Use this code, put in your device id, app, script and result path and run the whole line in Terminal
For a while now I've been trying to work out how to run UIAutomation tests from Jenkins - every time I run the build, it builds fine, then it runs my instruments command (using the same command as detailed here ( Can Instruments be used using the command line?) and jenkins just hangs, well the whole machine does, and when I look at activity monitor I can see an instruments process using 2gb of memory.
When I set up jenkins, I original ran it as from a hidden user - this presented some challenges with jenkins being a deamon and not being able to access the window server. I then decided to change the jenkins account to a normal user, logged in and ran instruments from the command line - this worked fine.. but still had no luck with running it from jenkins.
I have set the jenkins account as a developer - no admin though
Please let me know if there's anything else that I could try, or if anyone has got this running successful your guidance would be much appreciated - Thanks
Jenkins on OS X is started from a launchd script and will run as "daemon" by default. The thing to do is change the user in the launched script.
First, get Jenkins ready to shutdown (in "Manage Jenkins" in the GUI).
Then unload the job from launchd, like so:
$ sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
Then edit the "UserName" property in the launchd plist, using the user which you want to run jenkins. There's also a GroupName property, which you may want/need to adjust accordingly with your user's group.
Finally, reload Jenkins with:
$ sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
Hope that helps!
So if you run it as a daemon, first thing to check what happens if you run Jenkins in the foreground The simplest way to do it is with java -jar jenkins.war [other options] command (see this document).
Maybe you can use this https://github.com/houlianpi/robot4ios.
Then in jenkins execute shell:
sh setup.sh
sh runTests.sh ./sample/alltests.js "/Users/komejun/Library/Application Support/iPhone Simulator/5.0/Applications/1622F505-8C07-47E0-B0F0-3A125A88B329/Recipes.app/"
and the report will be auto create in ./ynmsk-report/test.xml