Pass a value to a Test As Step from parent/calling test?

4 posts, 0 answers
  1. Nick
    Nick avatar
    23 posts
    Member since:
    Nov 2013

    Posted 24 Feb 2014 Link to this post

    I need to pass a different value to a Test As Step every time it is called.  Is there a way to do this without using a datasource?

    Example calling test:
    1. Type 'user01' into UserNameTextbox
    2. Type 'pw01' into PasswordTextbox
    3. LeftClick on LoginButton
    4. Execute test 'Search'

    Example Test as Step 'Search'
    1. LeftClick on SearchRadioButton
    2. Type <desiredValue> into SearchTextBox

    In Step 4 of the parent test, I want to pass a different value to the typed value in Step 2 in the Test as Step so that I can reuse this 'Search' test for more then just a very specific search scenario.  Is this possible?  I don't want to have to connect this particular test to a datasource as I want to be able to do everything from the parent test.

  2. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 26 Feb 2014 Link to this post

    Hi,

    This really sounds like a data-driven scenario, which you can accomplish by passing the parent data source to the child test via the InheritParentDataSource test property. Other than that you can use the data extraction, basically save a value during test run to consume in the child test as well. See this article for example.

    Regards,
    Konstantin Petkov
    Telerik
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Nick
    Nick avatar
    23 posts
    Member since:
    Nov 2013

    Posted 26 Feb 2014 in reply to Konstantin Petkov Link to this post

    Thank you for the reply, Konstantin.

    I'm not sure a datadriven approach is suitable for this scenario.  We want to be able to reuse the example "Execute test 'Search'" Test multiple times within a single test run, with different data each time "Search" is called.  To do this in the same test would require multiple rows in the "Search" column of the data source.  I believe each row is handled as a separate iteration and is not what we are attempting to do in this situation because our desired test occurs in a single iteration.

    1. Type 'user01' into UserNameTextbox
    2. Type 'pw01' into PasswordTextbox
    3. LeftClick on LoginButton
    4. Execute test 'Search'
    5. Execute test 'Verify Results'
    6. Execute test 'Search'
    7. Execute test 'Verify Results'
    8. Execute test 'Search'
    9. Execute test 'Verify Results'

    Is it possible, given the above test, to bind ColumnA to the search test, and have values "search1", "search2" and "search3" be executed at steps 4,6 and 8?
  4. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 26 Feb 2014 Link to this post

    Hello Nick,

    You are absolutely correct about data rows driving the test execution in iteration for each row. That scenario doesn't seem to be suitable for a data-driven approach. Please give the value extraction a try instead.

    Regards,
    Konstantin Petkov
    Telerik
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top