In this article we are going to see how we can manage Jmeter Test Cases in maven plugin. This is continuation post of this original article.

Defaults : Run All Tests

By default maven jmeter plugins assume your all test cases are present in /src/test/jmeter folder. So when you just specify jmeter executions, it will run all the test, no need specify any test.


Specify Folder for Test Cases

To change default test case folder , we need to use testFilesDirectory


Example Project

  • In here I have added testcases folder under /src/test/
  • Default /src/test/jmeter folder has BDJOBS1.jmx, BDJOBS2.jmx
  • Our Selected /src/test/testcases folder has only BDJOBS.jmx. We will see only this test case executed and result produced.


Specify JMX to run

If you want to run specific tests, you should add in configuration with testFilesIncluded


Now, if you want to add multiple test cases, just add multiple test file


Multiple JMX Example

  • It has 3 JMX files
  • Only 2 of those are selected
  • We can see only two test case run and report generated.



Specify JMX to run by Regular Expression

If you want to run test cases with specific regular expression patterns, you can use regex.

For example, you want to run different type of login scenarios where each jmx contain each type of log-ins, so you should use like this. In here all login related test cases has prefix login.


Multiple JMX Example with regix

  • We have 3 jmx in the folder
  • We select regex login*.jmx which is present as prefix in 2 test cases. So, these 2 will run.



Excluding JMX

If you have many test cases in jmeter folder and you want to exclude test cases, you have to use testFilesExcluded


Like include , exclude also supports multiple files


Exclude JMX Example

  • We have 3 test cases
  • We excluded 2 of those and only one test case will run & report will be generated.


Excluding JMX with Regex

Like include you can also use regex to exclude. From include example, if we want to exclude all login test cases, we will use like this


Multiple Exclude JMX Example with regix

  • we have 3 test cases
  • 2 test cases were exceeded with regex login*.jmx. So, only 1 test case will run.


Notes :

  • Multiple tests will run serial , not in parallel.

Thanks :)