Ask a Question

Disable test cases depending on environment

New Contributor

Disable test cases depending on environment

In my project I have several test suites and several test cases in the each test suite. Quite normal.

All test cases have the same test steps, the differences are the payload. Something like this:

- generate access token

- Initiate

- signing

- execute

- get status

All these test steps are valid for our test environment. But for our sand box, which is more simple, we just need the following test steps:

- initiate

- execute

- get status

To be able to use the same test cases in both environments I would like to disable two test steps when executing my test cases against our sand box.

I have tried several methods but failed.

The optimal situation would be that all those test steps get disabled in all test cases when I change to the sandbox environment and get enabled when I change back to our test environment.

Could that be done on "Function Test-level", using SetUp Script/TearDown Script or using the Event Handler or are there any other methods for this?

Someone that knows?


Frequent Contributor

Hi @TonnyLi ,


In your project setup script, you could try something like this:

//given your environment config name is = "sandbox"

project.testSuiteList.each { suite ->
		suite.testCaseList.each { kase ->
			kase.testStepList.each { step ->
				if ( == "generate access token") {
					if ("sandbox")){


WoW! It worked! Thanks alot JoostDG!


Community Hero

There is another way to achieve the same provided if you tag the tests using the feature "Tag" (or Tags)


And one can run the tests linked to specific  Tag.


New Contributor, not really. It is some test steps I would like to disable in every test case. Not test cases. 

Showing results for 
Search instead for 
Did you mean: