Forum Discussion

davidcole's avatar
davidcole
Occasional Contributor
14 years ago

Multiple Test cases - run them according to a profile

HI

I have a number of test cases, and I'm trying to replicate user behaviour. Each test case is for a different product and our users user each product varying amounts. Ie one of the products is used about 90% of the time, and the others are split up that last 10%.

How can run each of the test cases according to this profile so that the one product runs many more times that the others?

3 Replies

  • Finan's avatar
    Finan
    Frequent Contributor
    Create the logic in a groovy script and use a counter or something similar to determine when to run a individual testCase.

    You can create the groovy script in a "master" testCase and add the individual testCases as runTestCase testSteps.
  • davidcole's avatar
    davidcole
    Occasional Contributor
    Thanks, I almost figured this out by myself. Only by looking after posting did I figure out that a test case could run other test cases.

    If I use something like:
    if( Math.random() > 0.5 )
    testRunner.runTestStepByName( "Request 1")
    else
    testRunner.runTestStepByName( "Request 2")

    Do I then have to add Request 1 and Request 2 to the test case? Or do I just have the script?
  • davidcole's avatar
    davidcole
    Occasional Contributor
    I think I've found that the Run Test Case steps have to be in the test case...but disabled.

    Otherwise they tend to run by themselves under the load test. If disabled, I can see them running as they count/tps etc update. And they seem to be updating according to my profile.