If one scenario fails continue with next Scenario in a cucumber feature file - cucumber-jvm

How can I continue running a feature on failure of 1 scenario to next?
Currently if first Scenario fails out of 10 (lets say) next 9 will not execute and it quits current session on driver/browser (WebDriver).
I am using Cucumber with Java, Junit, Serenity on Windows 7.

After updating all dependencies, plugins in pom.xml to their latest versions, fixed the issue.
Specially -
maven-surefire-plugin, maven-failsafe-plugin, maven-compiler-plugin

Related

Cucumber JVM generates empty JSON report

I have a suite of Cucumber tests being run by Jenkins periodically. Most runs are not generating a JSON report. More specifically, a zero sized JSON file is created. I'm using version 4.3.1 of cucumber-java, cucumber-java8 and cucumber-junit and Java 1.8.
My test setup is a little convoluted. Jenkins runs a job every 2 hours to run the tests. This job runs in its own Docker container (running a Linux image) wherein a fresh clone of the test repo is created. Jenkins then executes Gradle to build and run the tests.
In the Jenkins console output I can see Gradle starts the tests and presumably executes some but never completes them all. But there is no error or exception from Gradle, it simply stops running. Nor is there any message about the JVM exiting with a non-zero status.
There is the occasional run of the tests that will produce a non-empty JSON report. This tends to coincide with all of the tests passing, but not always.
Unfortunately I am not able to post the Jenkinsfile, build.gradle or anything else. If you need further details I might be able to provide small snippets.

JUnit5 Console Progress Status

I recently migrated my JUnit framework from 4.12 to 5.1.0 and noticed a minor issue. Was wondering if someone could help me get this sorted.
When I was using JUnit 4 with Gradle, I could see the Progress status of the test and the current test that was being executed when the tests were run in Console.
However, when I use JUnit5 and it's runners, I get the final completion report in a tree structure, which is amazing, But i'm missing my old console report where I could see the progress status with the current run being executed.
Is there a way to setup this using the JUnit5 setup?
Since version 4.6 Gradle has built-in JUnit 5 support which will provide standard progress status. The support however is still missing out on a few important features, see e.g. https://github.com/gradle/gradle/issues/4605

jenkins selenium tests ci

I have created a Jenkins maven task to run selenium tests on one project, and now I want to use these selenium test in a proper way for CI.
Actually, I have a Jenkins task which 1-builds the project, 2- uses sonar, 3 - deploys the project. I would like to add the selenium tests to this process. The question is: can I run the selenium tests before deployment? Is it necessary to do a previous deploy for the selenium tests before the real deployment? Is there anyway to simulate a deployment or something like that so I can run the selenium tests?I would appreciate If you could advise me on how to do or any plugin which could help me.
As per my understanding, To deal with the scenario you should run the selenium test on QA environment. If all test pass then deployment should start for staging etc.
Additionally, once the deployment is done on staging, then selenium script should run again, test staging and if something went wrong then rollback from staging should be happened.
I never tried it but you can use below github plug-in for deployment(in case you are using github) :-
https://wiki.jenkins.io/display/JENKINS/GitHub+plugin
If you are using SVN then use below :-
https://www.packtpub.com/mapt/book/application_development/9781783553471/3
Hope it will help you :)

Jenkins - Trigger Selenium test after deployment

I'm new to Jenkins, so please go easy!
I have a web application which we are developing, and we've started automating our release using Jenkins.
I also have a standalone Selenium WebDriver script which will perform a Smoke test on our web app. We usually run this manually each time there's a new deployment.
I heard Jenkins can automatically trigger Selenium tests. So what I did was to create a batch file, which will in turn call the Selenium script. I added a Build Step which will call this batch file.
What's happening now is Jenkins first Builds the WAR file, executes the batch (for selenium) and then deploys it to the target Tomcat.
But I was wondering if I could change the order to Build WAR --> Deploy to Tomcat --> Call the Batch file that executes Selenium Test. I want to do this as Jenkins Tests before deploying, which means my Selenium test still runs on the old build. This makes little sense, as I would rather run the Selenium test on the new build.
In short, is there a way I can execute the Batch file as part of a Post Build Step rather than a Build Step?
Thank you Würgspaß !!
I solved my problem by creating a separate Selenium Job which gets triggered automatically if my Build is successful. This way, I can create any number of downstream jobs to be triggered for a successful build.

how to use selenium grid with Specflow and Nunit and Webdriver (in DotNet version)

Presently we built a Automation framework which uses Selenium Webdriver+ specflow + Nunit, and we suing bamboo as our CI to run our Job against our every build.
we written a build.xml to handle our targets (like clean, init, install latest build, run Selenium scripts, uninstall build. etc)
ant command will read the tag name from the build.xml and runs the respective feature/scenarios based on Tags (like #smoke, #Regression)with Nunit in CI machine.
Now our requirement is to use Selenium Grid to divide scripts into different machine and execute with above set-up. Grid has to divide the scripts based on feature file or based on Tags.How to achieve this.
Is there any thing need to done under [BeforeFeature] and [BeforeScenario] ?
If you provide in details steps or any link which explains detail steps that would be a great help.
Please any one can help in this regards.
Thanks,
Ashok
You have misunderstood the role Grid plays in distributed parallel testing. It does not "divide the scripts", but simply provides a single hub resource through which multiple tests can open concurrent sessions.
It is the role of the test runner (in your case Specflow) to divide tests and start multiple threads.
I believe that you require SpecFlow+ (http://www.specflow.org/plus/), but this does have a license cost.
It should be possible to create your own multithread test runner for Specflow but will require programming and technical knowledge.
If you want a free open source approach to parallel test execution in DotNet, then there is MbUnit (http://code.google.com/p/mb-unit) but this would require you to rewrite your tests