This is a migrated thread and some comments may be shown as answers.

Update Execution Status through Coded Step

1 Answer 89 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Swaroop
Top achievements
Rank 1
Swaroop asked on 06 Jul 2011, 08:26 PM
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

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 06 Jul 2011, 08:42 PM
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?
Tags
General Discussions
Asked by
Swaroop
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or