Update Execution Status through Coded Step

2 posts, 0 answers
  1. Swaroop
    Swaroop avatar
    3 posts
    Member since:
    May 2011

    Posted 06 Jul 2011 Link to this post

    Hi,
    Pardon me if this topic is discussed some where else in the forum and I have failed to locate it.

    I have two questions:

    1. How can I update the execution status of a coded step through C# code
    Ex: If { "Pass" }
      else  {    "Fail" } 

    2.     How to use the variable (which has got the value by extraction  ) in a coded step which is coming after a few steps after extraction.

    Thanks in Advance.
    Swar
  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 06 Jul 2011 Link to this post

    Hello Swaroop,

    A coded step will be set to "Fail" by throwing an assert. Any assert will do the job. Any code following the assert will not get executed. The rest of the test steps also will not get executed (unless your coded step is set to "Continue on Failure").

    We recommend using our Assert class. There are many test conditions you can take advantage of which will conditionally fail the test if the condition being tested does not match. For example:

    Assert.AreEqual<int>(System.Drawing.Color.Azure.ToArgb(), bgColorSys.ToArgb());

    The above code will fail the test if the colors do not match.

    To use the value of an extracted variable use code like this:

    string newReq = (string)GetExtractedValue("varname");

    You can also set the value of a variable in code like this:

    SetExtractedValue("varname", newReq); All the best,
    Cody
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
Back to Top