How to configure Jenkins to run 1 selenium test case - java

I am running Jenkins on Windows 7 as service.
I have approximately 100 selenium test cases in package, but I want to run only 1 test case.
Is it possible to configure Jenkins to run not all, but 1 test?

Depending on how your Jenkins build is configured, somewhere you are specifying the maven goals. These can be configured to specify the test you want to execute, as described here:
mvn -Dtest=TestCircle#mytest test
Note that this require surefire 2.7.3 or later, and Junit 4.X or TestNG:
As of Surefire 2.7.3, you can also run only a subset of the tests in a test class.
NOTE: This feature is supported only for Junit 4.x and TestNG.
For older versions of the Surefire plugin/JUnit, it seems it is only possible to control this on class level, i.e. you cannot specify a specific test in a class:
mvn -Dtest=TestCircle test

Related

Will gradle run Tests annotated with #NotThreadSafe run as a single test process at a time

We have currently set up our application set up with Junit 4 and Maven with the surefire plugin.
Now we are migrating to gradle and we want to run the test case in parallel with the exception of the ones annotated with #NotThreadSafe. Given the long running nature of our test cases it is hard to find out if they are running in parallel or not.
Has anybody used the #NotThreadSafe annotation together with gradle?
In the gradle docs I wasn't able to find out if it is supported or not.

mvn package executes more tests locally that in bamboo

I have a spring-boot application which includes JUnit tests and I build using maven. I have organized by JUnit tests in a Suite using #Suite.SuiteClasses notation.
My problem/question is why when I run mvn package locally, I see that the unit tests referenced by the Suite are executed but they are also executed as if they were not part of the suite, while building the code in Bamboo, using again mvn package executes the tests only once (i.e. as members of the suite).
Do you use the same profiles / settings / maven commands on bamboo and locally?
I think what happens is that when executing the package phase the surefire-plugin starts executing all the tests. There might be a naming issue with the includes the surefire plugin uses by default.
If you execute the maven goal with -X you should be able to see the surefire-plugin configuration it uses to identify the tests. This should only match your suites - not the suites and the tests themselves.

Cucumber tests are being skipped

I am using cucumber framework in my project. So for the reporting part, i need have started building the cucumber reports with jenkins.
So during the setup for the trail build i am facing the below issues.
All the tests are skipped, but not executing.
Can anyone have solution. I am happy to provide any other inputs required.
When using maven and cucumber you have two options to run the tests.
With maven: mvn clean install
With cucumber:-Dtest=Runnerclass test
Where Runnerclass is the class name of runner.
Include surefire plugin in your POM.xml to pick your test. if you want to run test as well, then use mvn clean install.
Refer
How to run Cucumber JVM Test in Jenkins

How to configure Testng eclipse plugin with arquillian

I have arquillian set up here with some integration tests, but so far I'm running them with:
mvn clean test -Parq-jbossas-managed
I would like to run and see the errors/successes on the Testng eclipse plugin. How do I do that?
I have tried to add a testng running config, selection a class to test, but it didn't work.
Any ideas?
Running TestNG from its Eclipse plugin or from maven are two different things!
The TestNG Eclipse plugin comes with its own version of TestNG - afaik, this isn't possible (without starting eclipse processes from you build process)
If reporting matters to you, you should have a look at ReportNG
To start a test run with your Eclipse Plugin (so you can see it in Eclipse's dedicated view), you have to select your test-class (or your test-xml) and use Run As -> TestNG test.

How to get Hudson to show complete selenium report?

Our Hudson installation shows a very spartan version of the Selenium report:
Selenium Report Result
numTestPasses 2
numTestFailures 0
I've understood that it should be possible to view full reports via Hudson, and also track development of the tests. But how?
We configured Hudson to run Selenium through an Ant task. Then we added a post-build action to "Publish JUnit test result report." With this setup we can see each failed test name along with how long each test took and the ability to drill down into all the tests to see specifics.
You may be able to just add that post build action to your project using the Selenium plugin.
Not sure if this fits in your environment: I'm running selenium-rc via JUnit (and phpunit) test cases using ant in a Hudson freestyle Project.
Hudson collects and publishes JUnit and via xUnit Plugin various other test results in an optional post build step.
Maybe you just need to find out where the build process stores the actual xml report and instruct hudson to publish it?
I run Selenium tests in Hudson using this plugin. It runs my Selenium tests and publishes detailed test reports. Very easy to configure, maybe not perfect if you have a lot of test suites to execute.
We use the SeleniumHQ plugin. The results are saved in the workspace (this is done in the project config by using "Publish Selenium Report"). You can save the build reports by using "Archive the artifacts" in project config.
We have written the Selenium tests as normal JUnit tests, which gets executed with the rest of the tests, so the reports are embeded i the junit test report generated by hudson.

Categories