Inserting data driven tests inside other driven tests

4 posts, 2 answers
  1. Jan
    Jan avatar
    7 posts
    Member since:
    May 2016

    Posted 25 May Link to this post

    Hello! Quick question regarding how data driven test structure works.

    Let's pretend I have test A which logs into a website. Test B will now now use test A using 'test as a step' to get to the webpage and do additional things on the page.

    Now let's say I want to want to use different accounts for test A to log into the website so test A is now data driven. However, the content on the website changes for each different account so if I turn test B data driven as well, I need to verify certain elements that correspond to the account that was used to log in.

    If I follow this workflow however, and use data driven test A as a 'test step' inside test B, test A will run through all of it's data driven iterations before running anything in test B.

    I want each the data for test A and B to be executed in tandem so the flow becomes:
    log into account 1, verify on the website data belonging to account 1
    log into account 2, verify on the website data belonging to account 1

    How it currently works however, given my test flow, is:
    log into account 1
    log into account 2

    verify on the website data belonging to account 1,

    verify on the website data belonging to account 1

    ..which is not what I want. The only alternative I can think of is not using 'test as a step' to bypass the way the data driven logic is currently behaving. If there is any other way to switch up the order of how data driven tests work, please let me know, thanks!

     

  2. Answer
    Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 30 May Link to this post

    Hello Jan,

    Thank you for contacting us.

    This can be achieved as follows:

    1. Create one parent test which will have two test as steps (Test A and Test B).

    2. Create one data source with different columns for Test A and B.

    3. Bind the parent test to that data source.

    4. In the properties of Test A and B check InherintParentDataSource and DataEnabled.

    5. Bind the steps you want in the both tests to the column you want. Note that you should type the column names manually in the step properties (bindings) click the brackets and then the Set button.

    Find attached a demo project.

    Let me know if that helps.

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
  3. Jan
    Jan avatar
    7 posts
    Member since:
    May 2016

    Posted 07 Jun in reply to Boyan Boev Link to this post

    Thanks Boyan, that was a great help!
  4. Answer
    Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 09 Jun Link to this post

    Hello Jan,

    You are very welcome.

    If you need further assistance please let us know.

    Regards,
    Boyan Boev
    Telerik
     
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
     
Back to Top