Data-Driven Test with different results

8 posts, 0 answers
  1. Stefan
    Stefan avatar
    3 posts
    Member since:
    Aug 2011

    Posted 08 Aug 2011 Link to this post

    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
  2. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 08 Aug 2011 Link to this post

    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!
  3. Stefan
    Stefan avatar
    3 posts
    Member since:
    Aug 2011

    Posted 09 Aug 2011 Link to this post

    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
  4. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 09 Aug 2011 Link to this post

    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!
  5. Stefan
    Stefan avatar
    3 posts
    Member since:
    Aug 2011

    Posted 09 Aug 2011 Link to this post

    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
  6. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 10 Aug 2011 Link to this post

    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!
  7. Mark Cooper
    Mark Cooper avatar
    5 posts
    Member since:
    Sep 2005

    Posted 08 Sep 2011 Link to this post

    Is there anyway to do this with DataBinding from the UI?

    Thanks,
    Mark
  8. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 08 Sep 2011 Link to this post

    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!
Back to Top