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

Data-Driven Test with different results

7 Answers 149 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stefan
Top achievements
Rank 1
Stefan asked on 08 Aug 2011, 10:19 AM
Hello,

how can I create data-driven Test?

I want to test an registration for a website. The testscenario contains over ten specific testcases, with different results. I need to add different verifications for all these results.
Did anyone know a solution, where i can reuse many fragments?

br Stefan

7 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 08 Aug 2011, 03:15 PM
Hello Stefan,

If you haven't done so already, please review our online documentation on "Data Driven Testing" here and let me know if you need further assistance.

Kind regards,
Plamen
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Stefan
Top achievements
Rank 1
answered on 09 Aug 2011, 05:23 AM
Hello Plamen,

thanks for reply. I didn´t read these documentation so far. Thank you for  the link.

But it doesn´t answer my question. Wer can I add specific verfication steps to a data-driven test ?
In worst case, it would be for each step another verification, but the cycle for input would be the same and should be reuseable.

Any idea?

br Stefan
0
Plamen
Telerik team
answered on 09 Aug 2011, 01:52 PM
Hello Stefan,

I'm not sure I fully understand your scenario, but it sounds like you are after our Test as Step feature. You can create a parent test and insert a child test in it, which will do all desired verifications. 

Please check out this KB article on "Repeating actions for multiple users with login" for detailed explanation.
For example you can do something like that:
    Create Test A with 3 steps
        1) Registration to website (data bound to allow for multiple users with different credentials)
        2) Test as Step (Test B) 
        3) Logout
where Test B is also data bound to a different data source and performs a data driven verification. 
Note that the child test will execute all iterations from its data source before returning to the main Test A.

If this is not what you want, please explain your exact scenario in details and we'll do our best to provide a proper solution.

Hope to here from you soon!

All the best,
Plamen
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Stefan
Top achievements
Rank 1
answered on 09 Aug 2011, 02:04 PM
Hello Plamen,

this sounds fine. Can I decide when a Test as Step should executed? This depends on the Data from Test A.
I think about an datasource with the following columns:

DataA DataB Result
X           Y          R1
U         Z            R2

I want to choice which Test as Step was exceuted, If an specific result was present in the iteration.
For Example. When the column Result contains R1 I want to execute Test1 an when the column Result contains R2 I want to execute Test2. This sounds like an If-Else, but is it possible to make an decision that depends on the InputData?

I hope you can understand my problem and my englisch :)

br Stefan
0
Plamen
Telerik team
answered on 10 Aug 2011, 03:10 PM
Hello Stefan,

It appears that we are getting closer to the final solution. Try to implement something like this in a coded step:
if((string)Data["Result"] == "R1")
{
    this.ExecuteTest("DataA.tstest");
}
else if((string)Data["Result"] == "R2")
{
    this.ExecuteTest("DataB.tstest");
}
 
We use this expression "((string)Data["Result"] == "R1")" to take a value from the Result column in the data source and compare it to "R1". If the value from the data source is equal to R1, this line "this.ExecuteTest("DataA.tstest")" will execute our child test DataA.

The same thing is for the second "if" statement. It compares the value from the Result column to "R2", and executes child test DataB if they are equals.

You can use more "else..if" statements if you have more values in the Result column, and you can create as many child tests as you want.

Hope this helps!   

Best wishes,
Plamen
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Mark Cooper
Top achievements
Rank 1
answered on 08 Sep 2011, 10:26 AM
Is there anyway to do this with DataBinding from the UI?

Thanks,
Mark
0
Anthony
Telerik team
answered on 08 Sep 2011, 05:58 PM
Hello Mark,

You can come very close with a non-coded solution:

1. Create a parent test that contains a data-bound verification.
2. Insert an If...Else statement.
3. Attach the data-bound verification to the If...Else statement.
4. Add two Tests as Steps.
5. Drag one Test as Step into the If portion and drag the other into the Else portion.

Best wishes,
Anthony
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
Tags
General Discussions
Asked by
Stefan
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Stefan
Top achievements
Rank 1
Mark Cooper
Top achievements
Rank 1
Anthony
Telerik team
Share this question
or