How to add task to run parallel selenium tests in build.gradle - selenium

In our project we are using gradle to nuke the DB and also using gradle to run the selenium test cases in different suites. I am trying to run selenium test casses parallely. How to add task for that.

Related

How can I install Selenium RC in TeamCity?

I need to link Selenium IDE to automate the tests I have in my Firefox suite, but I don't know how to install Selenium in TeamCity.
Short answer, you don't. You have to record your tests in firefox, and then import them as a unit tests into your project (Maven for Java, NUnit for C# etc.). Then, run those tests as any others. Here are some solutions, you might want to take a look
Running selenium automation tests on remote teamcity build agent
Automate Selenium tests on TeamCity Continuous Integration server
Best way to wire up Selenium test automation
How to setup TeamCity for run selenium auto tests?

Should selenium tests be kept in separate project

I have a Java web app (Maven) where I have some Selenium tests.The testing framework is Junit 4.x.
I'm also using Jenkins for CI. Right now all my tests (integration + selenium) are kept under the src/test folder of the project.(classic maven structure)
Due to the fact that Jenkins cannot run selenium tests (it is not configured to do this - I'm running on a linux machine without a graphical interface and the solutions under this circumstances seems a little clumsily, but I was thinking to run a selenium server so that I can run all these tests on a windows slave machine ) I have to manually "remove from execution the selenium tests", otherwise I'll have a lot of failed tests.
What I want to accomplish is a scenario where:
1.Commit to SVN
2.Jenkins creates a build
3.Run the tests and if there is no problem here move to next step, otherwise,stop
4.Deploy the app to an app server
5.Run the selenium tests against that deployment as a post build script in Jenkins.
In order to have this running do I have to extract the selenium tests to other project ? (in order to avoid Jenkins running this tests along with the other integration/unit tests)
As you are using Maven and you say kept under the src/test folder of the project sounds just Perfecto.
You havn't mentioned in your question why Jenkins cannot run selenium tests (it is not configured to do this). As later in your question you have mentioned Run the tests, presumming you are using TestNG it's just one step configuration for Jenkins to execute pom.xml of Maven which will inturn call the *testng.xml as mentioned below :
Ensure your Automated Test Suite executes properly as TestNG Suite and Maven Test.
Start Jenkins and browse to Manage Jenkins -> Configure System
Scroll Down to JDK -> JDK installations and ensure JAVA_HOME is set to C:\path\to\jdk1.8.0_144. Uncheck Install automatically
Scroll Down further to Maven -> Maven installations and provide Name as MAVEN_HOME & MAVEN_HOME as C:\path\to\apache-maven-3.3.3. Uncheck Install automatically
Scroll Down to JDK -> JDK installations and ensure Local Maven Repository is set to Default(~/.m2/repository).
Apply & Save
On Jenkins Dashboard, Create a New Item as Maven project.
Scroll Down to Build section and provide Root POM as absolute path of the pom.xml e.g. C:\Users\<user_name>\LearnAutmation\maven.jenkins\pom.xml
Set Goals and options to clean install
The final step would be to move the testng.xml within \ProjectWorkSpace\src\main\resources\testng.xml and your pom.xml you have to mention the location of testng.xml as below :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
Build your project through Jenkins
As per your specific question In order to have this running do I have to extract the selenium tests to other project ? the answer is No.
Solution :
If you want to execute both the Suites Integration and Selenium, this setup is yours.
If you want to execute either of the Suites seperately, divide the Integration and Selenium suites in different TestNG Groups and turn ON & OFF the execution of the TestNG Groups.

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

build and run Espresso tests having only application apk

Is it possible to build espresso tests having only application apk, witout sources?
connectedAndroidTestMinSdkVersion_14_Debug gradle task is willing to rebuild application. I have seen earlier a guide how to setup test build environment seperated from application build, using gradle, but unfortunately cant find it again.
By the way, wat is the base solution to run espresso tests in continious integeration if application under test is built by Ant scripts?

Bamboo recognising JBehave tests

I have setup Bamboo to run JBehave tests on a remote agent (with JBehave-web plugin launching test using webdriver), and everything runs fine. Only problem is after the execution is finished Bamboo shows no test executed. I can see the option in Bamboo to select the output of the test results, but it has to be a JUnit xml, and Jbehave reports are only generated in plain text or html.
Any idea how to solve this?
Thanks
I ran in the same situation about a year ago. JBehave "doesn't" integrate with Bamboo out of the box. Although, they have a plugin for Hudson CI.
In my case, such as yours, I resorted in running the tests through the Surefire plugin; the outputs are considered as JUnit tests results and Bamboo can recognize them.
Hope it helps.
There is a really simple way to do this. And I'm currently doing this for our build system.
Write a simple parse script that transforms your plain of html report into JUnit compatible results. And add that script as a task in your Bamboo task, then use Junit parser to parse the results. Boo! You're done! Plus, you've got the capability to quarantine!
This is way much faster than writing a plugin for Bamboo, which involves considerable more time to learn/write.
Setup JBehave with Maven.In Bamboo build plan use Maven task to run it. For getting results in Bamboo use JBehave Task for Bamboo. It will convert JBehave scenarios in tests in Bamboo. If scenario names contains JIRA issue ids, it will link them to JIRA issues.
https://marketplace.atlassian.com/plugins/com.mdb.plugins.jebehaveforbamboo/server/overview
Sample JBehave as Maven Project
https://bitbucket.org/vikasborse/jbehavesampleproject/overview
Download or clone this repository on your local machine.
To run navigate to this project in command line and use command:
"mvn integration-test"