Selenium : How to execute test cases at parallely using cucumber with maven - maven

We have execute the different test scenarios in different feature file using cucumber with maven in eclipse.
EX:
FeatureFile1:Login1
Scenario:UserLogin
Given:the userName is "aaa"
When:the login button is clicked
Then:the user login as successfully
FeatureFile2:Login2
Scenario:UserLogin01
Given:the userName is "bbb"
When:the login button is clicked
Then:the user login as successfully
In above example how to run in parallels and also how to configure in pom.xml file.
Regards,
Gopal

I have no idea how to solve it using maven only. I'm using jbehave and run tests in parallel with testng. It provides xml which operates test running and there you could specify amount of parallel threads and what exactly should be paralleled (metods, tests, suits). On build server use maven command:
mvn test -Dtestng.xml.file=suite.xml
Also you could use surefire plugin with any test provider.
http://testng.org/doc/index.html
http://maven.apache.org/surefire/maven-surefire-plugin/index.html

Related

Disable Integration test case using gradle command in springboot

I am using POSTGRES SQL as DB for my springboot application .Sonarqube integration test cases fail as SonarQube is unable to connect to DB.How can i disable my integration test cases using gradlew command during Jenkins build ?
Below is link where i have shown my code in detail SonarQube does not calculate code coverage
You would likely have to have some kind of naming convention for the tests you wish to exclude. Then, you can readily exclude them using something like the following:
In your build.gradle file, add:
test {
if (project.hasProperty('excludeTests')) {
exclude project.property('excludeTests')
}
}
From the command line:
gradle test -PexcludeTests=**/Integration*

What is relation of Cucumber feature files with Test Runner file in Karate?

I have found if I only add karate core dependency and run my tests, they run fine and report is generated.
So what is importance of making a test runner class? I can run my karate tests without it as well. Kindly explain!
With Karate runner class , you can use #KarateOptions to include or exclude feature files that you want to run eg #KarateOptions(features = "classpath:FeatureFiles/test.feature" , tags = "~#Smoke") will run all feature files other than the one having #Smoke tag .
How to pass parameter to run Karate tests from cmd/terminal as maven project
If we want to run only 'Smoke' tests then code can be written as :
Open cmd/terminal
cd 'karate project path'
mvn test -Dkarate.options="--tags #Smoke classpath:FeatureFiles"

How to execute a shell script in maven

I am trying to incorporate a shell script in my maven build. This is what I want:
Transfer unit tests to a server, run the tests on the server, transfer the output of the tests back to the maven build, maven then parses the test results and continues/fails based on the output. (I know this is a weird way but because there are no testing plugins for the chosen programming language on maven, this is the most efficient way of introducing unit tests).
I have written a shell script on the server, which does run the tests and places the outputs in a /testOutput folder on the server. But I have 2 problems:
How would I be able to run the shell script, located on the server, using maven and how would I be able to run it with sudo?

Running xml test suite with jenkins

I know how to configure Jenkins to run a particular test class using mvn -Dtest = nameoftest test in my windows batch command. However, how can I run a xml script that contains many tests?
for anyone who stumbles upon this, you run an xml file via jenkins like this..
mvn test -DsuiteXmlFile = src/whatever/path/my_file.xml

how can I run maven test case

I have create a small web project using maven.so I want to add test classes and directory to that project.I'm using eclipse as IDE my source folder is "src/main/java" I added test source folder "src/test/java" and added one test class with one test selenium casetry to compile and run it using "mvn test" command,But console only shows "run 0 failure 0 error 0 skip 0",Can any one explain me how to run my testcases properly,is there any configurations to do ?
thnxx
mvn test runs unit tests without additional configuration, but for selenium you need to refer to selenium maven plugin.
If your tests are not in the default location src/test/java, you can specify the alternate location as follows:
<testSourceDirectory>${basedir}/my/alternate/location</testSourceDirectory>

Resources