Forum Discussion

Asubbiah's avatar
Asubbiah
Contributor
9 years ago

Disable testcases in a particular environment

Hi

 

I have a testsuite with some testcases (REST services) and 3 environments.

 

Env1

Env2

Env3

 

When I select Env1 or Env2, and run my testsuite, all the testcases should be executed.

But few tests are not applicable to Env3. When I select Env3, and run the testsuite, few of my testcases/teststeps should not get executed (like disabled state).

 

how do I handle this? I have around 100 tests and have to disable around 10 - 20 tests for Env3.

1 Reply

  • nmrao's avatar
    nmrao
    Champion Level 3

    You should be able to do it. However, there should be a list for each environment which ones to be enabled or disabled.
    for eg: below line of code is to enable, and opposite for disable of a test step.
    testStep.disabled = false

    For instance you may also use system variables like -Denvironment=QA

    Put this in a project load script on meeting conditions you needed.
    if QA enable this list
    else Dev enable this list
    else enable this list.