This is a migrated thread and some comments may be shown as answers.

Causing a test to end

1 Answer 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Carl
Top achievements
Rank 1
Carl asked on 04 Sep 2012, 02:17 PM
Hi there 
        I have a test scenario where I Have a large number of rows of test data in my bound data source, but in any given test run only some of them will be valid, I have worked out how to use a logical If step to skip rows that are not relevant but I was wondering if there was a way I can get the test run to end after it has found a certain number of relevant records rather than waiting for it to check all the rest of the records.

So for example
let’s say I have 500 rows of data and I know that 5 of them are valid for this test, lets also say that the If statement finds that rows 1, 3, 5, 7 and 9 are valid how can I tell test studio to stop the test run and not bother checking the other 491 rows?

Thanks

Carl

1 Answer, 1 is accepted

Sort by
0
Accepted
Stoich
Telerik team
answered on 04 Sep 2012, 03:17 PM
Hello Carl,
your best option might be to go by code:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/coded_steps.aspx

You can probably workout some sort of a non-coded solution based on IF/Else and Loops  (addable from the GUI) but it will almost certainly be more trouble that its worth.

Here's what I would recommend:
put the verifications in a separate test (reference). Let's say we name it VerifyRows. We can put that in a while loop like so:
int counter=0;
 
while (counter > 7) {
 this.ExecuteTest("VerifyRows.tstest");
counter = VerifyRows.MyGlobalIntVariable
}

This solution hinges on the VerifyRows having a global, static int variable. VerfiyRows should have a way to increment this variable every time the event that you're looking for occurs (e.g. you find a row that you're looking for):
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/knowledge-base/project-configuration/common-global-functions.aspx

There are a lot of different ways to implement this - it will depend on your personal preference to a degree.

Let me know if you have any additional questions on this setup. 

Greetings,
Stoich
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Carl
Top achievements
Rank 1
Answers by
Stoich
Telerik team
Share this question
or