How do you programatically get test results into a variable

Class library usage, coding and language questions.
smullin
Posts: 1
Joined: Wed Jun 19, 2013 9:23 pm

How do you programatically get test results into a variable

Post by smullin » Wed Jun 19, 2013 9:30 pm

I am trying to create my own report and need to get the status (success / fail) of a validaton. How do I get that into a variable.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How do you programatically get test results into a variable

Post by Support Team » Thu Jun 20, 2013 4:37 pm

Hello,

In general the return value of the Validate.Exists() method is a bool.
If the validation failed, the return value is False otherwise it is True.
You can just write it in a variable using the following code:
string myVar = Validate.Exists(path, searchTimeout, message, exceptionOnFail).ToString();
You can just write it in your report using Report.Info(myVar).
Please let me know if you need more information or assistance.

Regards,
Bernhard
.
Image