Running xml test suite with jenkins - maven

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

Related

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 run tests in a folder in maven

I am using spring-boot. I have my tests segregated in the following manner
tests
|java
|endtoend
|org.mycompany.tests
|integration
|org.mycompany.tests
|unit
|org.mycompany.tests
When I run a mvn test or package everything inside tests folder are running. I want to run the test within individual folders. Intellij is able to run unit, integaration and endtoend separately.
I saw posts for running tests within a package. All my different test folders have the same package structure. So filtering by test packages will not help me.
If intellij is able to run the folders individually, I think I am just missing the command to run it from the cmd line. Please advise.

How to run JMeter test from Jenkins

How to run jmeter test from Jenkins, here i want to run my jmeter test with jenkins and tried to configure the Jenkins with Performance plugin based on the information got after googling.
In Google the solution is provided where jenkins is hosted locally and in Build we configure command line execution by providing jmx file path and so on...
the problem comes when my jenkins is in other server like http://172.27.80.57:8080/... here if i give Command line execution by providing jmx file path my build will fail..because my path is in different location..
So How to over come this as i am new to Jmeter and my boss want this result to be shown in jenkins ....and if there is any plugins which i need to install or is there any place where i am missing, please let me know ....this is very important for me....
OR is there any possibility that where we can push our changes to Git lab using CI tools such as Sourcetree...etc and then run those in Jenkins.
Thanks in advance.
You will need to install Jenkins build agent to the machine which you plan to use as JMeter load generator, check out Distributed Builds Jenkins Wiki page.
Also JMeter test is possible using Jenkins Pipeline feature. For more information check Running a JMeter Test via Jenkins Pipeline
Hope this helps.

TestNG+Maven, how to run a block of code before calling the TestNG.xml using mvn test?

TestNG+Maven, I have a framework where a block of code generates the testNG.xml on runtime, so my problem is that when I execute the command - mvn test, it starts looking for the TestNG file which is still not there because the code to generate that TestNG.xml is yet not executed.
So I want to know an approach where whenever I execute mvn test, system should first execute a block of code (I already have that code which generates the TestNG.xml file) and pom.xml should pick the newly generated xml file and start running the test cases from newly generated testNG.xml.
You just need to create a .bat or .sh file.
using these batch files you can trigger your first code and once it will complete the mvn command will be triggered.
below are some links which can help you to create a batch or sh file
https://fossbytes.com/what-is-a-batch-file-in-windows-how-to-create-a-batch-file/
https://askubuntu.com/questions/223691/how-do-i-create-a-script-file-for-terminal-commands/223698
Hope it will help you :)

Bamboo Script Task using inline bat commands failing

Im new to Bamboo and just trying to run this two lines of code in the script task.
cd C:\apache-jmeter-2.11\bin\
jmeter-n.cmd Test.jmx​
It is failing and it is showing this message on the logs.
Failing task since return code of [c:\Program Files\Bamboo\temp\TEST-16-ScriptBuildTask-4637676047487491491.bat] was -1 while expected 0
Is path to JMeter correct?
Does Test.jmx script live in JMeter's bin directory
Do you have "java.exe" in your PATH environment variable? Does Bamboo pick it up?
Can you look into "C:\apache-jmeter-2.11\bin\Test.log" file to see whether they are errors there. If there is no such a file one of points 1-3 isn't met.
Are you aware of Bamboo JMeter Plugin?
By the way, Bamboo is capable of executing Ant or Maven tasks and JMeter test can be kicked off using these build systems as well.
References:
Automated Performance Testing using Maven and JMeter
JMeter Maven Plugin
5 Ways To Launch a JMeter Test without Using the JMeter GUI

Resources