Forum Discussion

Buschfunk's avatar
Buschfunk
Frequent Contributor
13 years ago

[Resolved] Alternate test steps

Hello,

I have created a test case which runs in an endless loop to simulate a certain behavior. This test case contains two test requests:

Request #1: Positive data
Request #2: Negative data

Now I would like to alternate which request is sent, i.e. on each second run the negative request shall be sent.

Run #1: Positive request
Run #2: Negative request
Run #3: Positive request
Run #4: Negative request
[...]

Could you tell me an easy way, maybe via a Groovy script, to do this?

Thanks!

2 Replies

  • Hi,

    you could create a groovy script before these two that enables/disables each request alternatively for each run;

    def request1 = testRunner.testCase.testSteps["Request 1"]
    def request2 = testRunner.testCase.testSteps["Request 2"]

    request1.disabled = !request1.disabled
    request2.disabled = !request1.disabled

    Does that help?

    regards!

    /Ole
    SmartBear Software