Parallel tests in Android with cucumber, appium and testNG in java - java

I have 5 real devices in which I want to execute 20 tests, for example: 4 tests in each device in parallel, that is, in device 1 test 1 is executed, when the test ends, test 2 follows, in device 2 test 5 , at the end of test 5, follows 6... I can only run 1 test on each device in parallel, when I run more than 1, the test fails. Is there a way to specify that the current test is expected to finish before the next one starts? I am using Cucumber, Appium, testNG

You've got to set dataproviderthreadcount somehow.
And that depends on how you run TestNG.
Via the CLI: https://testng.org/doc/documentation-main.html#running-testng
Via Maven: https://maven.apache.org/surefire-archives/surefire-2.21.0/maven-surefire-plugin/examples/testng.html

Related

Fitnesse test page throwing an exception

I'm running Fitnesse testing tool via Jenkins. Jenkins runs fitnesse after fixed interval. Following is the test page:-Fitnesse Test Page
1.creating script file
2. running it
In this, I'm simply printing message but this test page sometimes thrown an exception:-
java.util.NoSuchElementException
at java.util.LinkedList.removeFirst(LinkedList.java:270)
at com.objectmentor.fixtures.LineGatherer.readLine(LineGatherer.java:42)
at com.objectmentor.fixtures.CommandLineFixture.flush(CommandLineFixture.java:291)
at com.objectmentor.fixtures.CommandLineFixture.flushProcess(CommandLineFixture.java:65)
at com.objectmentor.fixtures.CommandLineFixture.endTable(CommandLineFixture.java:59)
at com.objectmentor.fixtures.CommandLineFixture.doTable(CommandLineFixture.java:48)
at fit.Fixture.interpretFollowingTables(Fixture.java:121)
at fit.Fixture.interpretTables(Fixture.java:107)
at fit.Fixture.doTables(Fixture.java:81)
at fit.FitServer.process(FitServer.java:81)
at fit.FitServer.run(FitServer.java:56)
at fit.FitServer.main(FitServer.java:41)
Exception
This exception thrown sometimes and sometimes it work perfectly. It fail 2 out of 10 times . and I didn't change anything , i am simply running same test after every 30 min.

Intellij feature Rerun failed Test giving error

I am running cucumber test cases in bulk.
Suppose I have 5 feature files to run in bulk and one failed out of it.
So in next execution I'm trying to run failed test cases, for that I'm trying to use Intellij provided feature, i.e. Rerun failed Test. So when I click on it, it gives me below error.
Error:
0 test classes found in package 'test.java'
Picked up JAVA_TOOL_OPTIONS: -'path of JAVA_TOOL_OPTION'
Process finished with exit code -2
Empty test suite.

How to uploading test result in HP ALM

i want to run my test script written in Java+Selenium+TestNG in HP ALM. I created Vapi-XP test and batch file which run my test. But if test failed it will report a pass. How to uploading test result?
mycommand = "C:\PSelenium\RunVapi.bat"
TDOutput.Print "Starting " & mycommand
result=run(mycommand,0,true)
TDOutput.Print "Test ended with " & result
You might want to check Agiletestware Bumblebee integration platform which can help you to automate exporting results of Java+Selenium+TestNG tests into HP ALM. Check out this and this also.
Disclaimer: I'm developer of Bumblebee
You have 2 Global Objects in the scope of a VAPI-XP Test: CurrentRun, CurrentTest. They correspond to the Run and Test interfaces respectively. Setting the Status property on Both Objects should be the way.

Terminating an AWS Code Deployment with Java jar return value

I have an aws instance running with webservices that I want to test with a java application running JUnit. If I have a script that runs the jar during the validate services step of the code deploy process how does the code deployment handle the return value of the jar if a test fails?
Is it required that I catch exceptions thrown by the jar for the failing tests and call system.exit(-1) to have the script terminate the code deployment or does the exception thrown automatically give the return value of non-zero?
If you are running JUnit using JunitCore, it should return a non-zero exit code if any of the tests fail.
main
public static void main(String... args)
Run the tests contained in the classes named in the args. If all tests run successfully, exit with a status of 0. Otherwise exit with a status of 1. Write feedback while tests are running and write stack traces for all failed tests after the tests all complete.
Parameters:
args - names of classes in which to find tests to run
From: http://junit.org/apidocs/org/junit/runner/JUnitCore.html#main%28java.lang.String...%29

Maven -Dtest=* test, does not seem to run all tests

I've got a Jenkins CI server that is set up with a Selenium test project running with maven-surefire. I need the project to be a parameterized build, so that I can trigger the build via URL with a Dtest as a parameter (and only run the tests I specify in the url). This works great.
Unfortunately, I've been unable to figure out how to run ALL of the tests, while in this parameterized configuration. Since it is in parameterized build mode, I must ALWAYS specify the -Dtest parameter.
Based on the Surefire documentation, it seems like I should be able to wildcard the test names, and everything will be run:
-Dtest=* or -Dtest=Test*
The odd result of running these parameters is a print statement (that I created) from all 6 of the tests (denoting that they were all started):
"Test <test_name> started, click here to see the SauceLabs video"
And then the standard test result (below) for only 4/6 tests
Running <test_class_path>
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.048 sec
Followed by the summary:
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
If it matters, the tests are being run in parallel using surefire, and one other odd thing is that while printing out the individual test results, after the 4th one, the 5th result starts printing, but never shows a result, and includes a $1 at the end:
Running <test_class_path>$1
Please let me know if I can clarify anything or answer any questions.
Thanks in advance for any help!
I think that it's a regular expession:
mvn -Dtest=.*
works for me.

Categories