Chxk
Chxk

Reputation: 47

How to disable test cases in JMeter non-GUI?

If I run a test suite, it will run all the test cases inside it (i.e. 30 test cases). But how to disable some of the test cases so I just run 20 test cases instead of 30 test cases in that test suite for example. Is there any command to do it?

Upvotes: 0

Views: 1157

Answers (2)

Dmitri T
Dmitri T

Reputation: 168122

You can use the following __groovy() function in order to determine the path to the test plan

${__groovy(org.apache.jmeter.services.FileServer.getFileServer().getBaseDir().contains('TestCase04'),)}

To include 2 clauses:

${__groovy(org.apache.jmeter.services.FileServer.getFileServer().getBaseDir().contains('TestCase04') || org.apache.jmeter.services.FileServer.getFileServer().getBaseDir().contains('TestCase05'),)}

You can use the above functions directly in Thread Group like:

${__groovy(if (org.apache.jmeter.services.FileServer.getFileServer().getBaseDir().contains('TestCase04') || org.apache.jmeter.services.FileServer.getFileServer().getBaseDir().contains('TestCase05')) {return '0'} else {return '100'},)}

enter image description here

More information: Apache Groovy - Why and How You Should Use It

Upvotes: 0

Ori Marko
Ori Marko

Reputation: 58812

You need to add If Controller as a parent for each TestCase

Add the property ${__P(do_the_search,0)} == 1 to the If Controller:

in order to run the script with the search part of the script turned on, we simply pass this command to the console:

jmeter -n -t <test-name> -Jdo_the_search=1

Upvotes: 1

Related Questions