How to run a test multiple times

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in SOAtest
How to run a test multiple times
1. How to run a test multiple times?

2. I need to run two tests multiple times in a test suite, which has other tests as well. Other tests need to run only once. But the two tests alone has to run multiple ttimes. where do I configure?


Tagged:

Comments

  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    edited October 2010

    1. How to run a test multiple times?

    2. I need to run two tests multiple times in a test suite, which has other tests as well. Other tests need to run only once. But the two tests alone has to run multiple ttimes. where do I configure?


    Hi Partha,

    When you say run multiple times, am I correct to assume that you are feeding your tests different values with a data source for each run? If you desire to run these two tests multiple times, than you will want to put them in there own test suite. Right click on the encompassing test suite, and click "Add New > Test suite" , and create an empty test suite. You will then want to drag your two tests into this test suite, and open the test suite. Under the "Execution Options" tab, under the "Test Execution" tab, you will see three different kinds of test relationships. This is what you will have to change to attain your desired behavior. "Tests run as a group" should be selected. To make sure that your tests are running in the correct order with the desired behavior, make sure to look at the console view as the tests execute, as it will tell you the order of test execution. Also keep in mind this will only work if one of your tests has a parameterized value. Test relationships have to do with how tests iterate over data sources. In this case if you parameterized one test, both tests would run for each row of the data source. This is as opposed to the the case where one test executes for every row of the data source before moving on to the next un-parameterized test. It might be somewhat hard to describe, but the easiest way to understand this is to play around with it by selecting different test relationships, then run your tests and see the order that your tests run in the console view. Let me know how this goes for you.

    Regards,

    Jon
  • rohitmohiterohitmohite Posts: 5

    Hi Jon,

    If the test which we are running once i.e "testsuite_1" gives the value of, How many times I want to run the other testsuite i.e "testsuite_2" (one which we want to run multiple times). How can I pass the value from "testsuite_1" to "testsuite_2" and control the loop of "testsuite_2" depending on the value.

    Thank You.

    Regards,
    Rohit

  • OmarROmarR Posts: 205 admin

    One approach would be to capture the value from TestSuite #1 and assert that the value meets the desired value. For example, you could use a databank to extract the value and do an xpath to return a boolean value if a condition is met.

    You could then use that variable in your TestSuite#2 to control whether or not TestSuite#2 shall continue looping or not.

Sign In or Register to comment.