Jenkins - Trigger Selenium test after deployment - selenium

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.

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.

Can we execute/trigger selenium automation scripts through UFT

Using Webdriver, I have automated web based Application in eclipse and using QTP, I have automated Power Builder application(like desktop App).
Now both become depended module for me, from PB data's are flowing to web base application.
so, how can I achieve this. please someone provide me how to proceed with situation and give me some strategy to proceed
We have exactly the same situation where powerbuilder application is integrating with the web application, below is the solution we have followed
We are using jenkins for executions, but this can be done without jenkins also.
We have one jenkins job which executes a UFT test first and then executes the selenium test if UFT test is successfull.
At the end of test execution UFT test will generate a file with the information required by selenium test and then jenkins will trigger selenium test, selenium test will read this file to gather any required information.
Results are interpreted in the following way
If UFT test fails then jenkins will not trigger the selenium test. If the whole jenkins job is executed successfully then integration is working, if the UFT part failed then Powerbuilder is having issue and if selenium part failed then web application is having issue.

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 :)

Test Automation: TeamCity with Selenium and SOAPUI and Calabash

We are building apps for iOS and Android. Currently we are experimenting with TeamCity for CI.
Currently we have various tools to help us in the Test automation.
1. Selenium: For testing the web interface
2. SOAPUI: For testing the web services
3. Calabash-iOS: For testing iOS app
This is the scenario that we have done successfully with TeamCity:
1. Developer commits code to BitBucket
2. TeamCity runs calabash
3. If calabash pass, TeamCity will build and give the artifacts
This is the scenario that I am trying to do so that I can achieve an end-to-end automated testing:
When developer commits his code to our Bitbucket git repository,
TeamCity will trigger Calabash to run and check for the UI and the output of the details. On end,
TeamCity will trigger Selenium to add data in the Back Office web. On end,
TeamCity will trigger SOAP UI to check newly added data. On end,
TeamCity will trigger Calabash to check the newly added data
Has anyone tried this before or can give me an idea on how I can approach this?
You can setup different builds for each step since you can trigger builds via simple GET requests triggered by a script. TeamCity Accessing Server by HTTP
We run a similar setup. Basically we have one build kick off the Selenium/SoapUI scripts. That build doesn't wait for the job to finish, it just kicks it off. Then in our Selenium/SoapUI tests as the last step we hit the URL for the next build that picks up reports etc.

Run local Selenium Tests via Jenkins/Hudson

I would like to run local Selenium test script written in Java, via Jenkins/Hudson. Is it possible to run scripts from my local windows machine? So far I have written some simple Selenium tests in Java, which run perfectly if I execute them via Eclipse IDE. I would be thankful for an in-depth explanation.
Selenium test in Java: assuming them to be laid out as unit tests (junit or testng), second assumption is that project is governed by either ant or maven, so there is some test (or rather integration-test) target or phase being present and be running smoothly when invoked from IDE.
When such tests are launched, they hit to a running selenium server (remote-control) which in turn launch a browser and runs its magic. Here are options: selenium server might be running in background (and be always available), or it might be started right before that testing and shut down afterwards. The latter is a common case for maven: pre-integration-test phase is configured to launch selenium rc, (then integration-test phase runs the tests against it), post-integration-test shuts selenium rc down.
So up to this moment we might want to learn what targets (ant) or phases(goals) your IDE invokes when it launches your tests successfully (also, what variables it sets or what profiles it enables).
If you invoke the same command from cmd (like 'mvn clean integration-test') and it runs successfully (same as IDE), then just instruct jenkins to run the same goals/targets (I assume that jenkins is running on the same machine, at the same user session).
If cmd doesn't do the trick (and you've looked quite well into what IDE does for you when it launches your tests), then I'd asked for more details.
So, involved participants are: 0. ant/maven that run your junit tests 1. selenium rc that should be running in bg or launched by ant/maven first 2. browser (path to browser executable) 3. jenkins (which was assumed to be running in the same environment).
If any of the assumptions are false, please come up with more details of your setup.