Disabling test steps during runtime

3 posts, 1 answers
  1. Jon
    Jon avatar
    11 posts
    Member since:
    Nov 2015

    Posted 20 Sep 2016 Link to this post


    I am using Test Studio to develop automated tests for a complex WPF application.

    I am wondering: Is there any API calls I can make in a coded step that allows me to disable specific steps from being run during test execution? 


    For example:

    if (some condition)


      disable steps 2-4 of this test




      execute all steps of this test



    I want to have the condition be the value of an environmental variable on the computer where the test will be ran. (Will be ran on multiple different computers with the same environmental variable set to different values).


    Let me know if there are any methods out there I could use.




  2. Answer
    Nikolay Petrov
    Nikolay Petrov avatar
    231 posts

    Posted 22 Sep 2016 Link to this post

    Hello Jon,

    It is possible to skip a test step during the runtime of the test. To complete that follow the steps:

    - add an assembly references to your project for:
     System.Runtime.Serialization - .NET library  (C:\Windows\Microsoft.NET\Framework\v4.0.30319)
     Telerik.TestStudio.Interfaces - \bin directory of the TestStudio installation (C:\Program Files (x86)\Telerik\Test Studio\Bin)
    - usings:
    using ArtOfTest.WebAii.Design.ProjectModel;
    using ArtOfTest.Common.Design.ProjectModel;

    - code lines:
    // loop over all test's steps
    foreach (AutomationStepBase step in ExecutionContext.Current.Test.Steps)
        // log the number of the test step - for debugging
        // will skip 2-nd step in the test
        if (step.Order == 2)
            // disable the step
            step.Enabled = false;

    I hope this example is useful to you.

    Nikolay Petrov
    Telerik by Progress
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Jon
    Jon avatar
    11 posts
    Member since:
    Nov 2015

    Posted 04 Oct 2016 Link to this post

    Thank you, this is exactly what I was looking for!
Back to Top