Page 1 of 1

A test in two steps

Posted: Thu Mar 31, 2016 10:18 am
by giuseppe.lacagnina
Dear All,

I apologize in advance if my question is silly. I am designing a test case with two modules, let us call them A and B. What I need to do is to find the best way to achieve the following

- A is executed
- B is executed also if A fails
- the overall test case must fail if A or B (or both!) fail

How should I proceed? I do not want to have two separate test cases.
Thanks!!!

Re: A test in two steps

Posted: Thu Mar 31, 2016 11:52 am
by Martin
Add a variable for both modules (e.g "varTestStatus") and bind them with a parameter for the testcase.

Module A:

Do your userCode actions and in the validation part do the following:

(random validation example)
if (repo.TextObject.InnerText == RequiredValue)
{
    Report.Success("Success");
    varTestStatus = "Success";
} else {
    Report.Failure("Failure");
    varTestStatus = "Failure";
}
And in the Module B group your usercode under an If clause
if (varTestStatus == "Failure")
{
    // Do your required userCode actions (you could just link methods)
} else {
    Report.Info("Module A did not fail!");
}

Re: A test in two steps

Posted: Thu Mar 31, 2016 12:18 pm
by giuseppe.lacagnina
Thanks!

Sounds good. I will try it.