A test in two steps

Ask general questions here.
User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

A test in two steps

Post by giuseppe.lacagnina » Thu Mar 31, 2016 10:18 am

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!!!

Martin
Posts: 152
Joined: Fri Aug 15, 2014 12:24 pm

Re: A test in two steps

Post by Martin » Thu Mar 31, 2016 11:52 am

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!");
}

User avatar
giuseppe.lacagnina
Posts: 113
Joined: Fri Sep 18, 2015 10:25 am
Location: Brunn am Gebirge, Vienna, Austria

Re: A test in two steps

Post by giuseppe.lacagnina » Thu Mar 31, 2016 12:18 pm

Thanks!

Sounds good. I will try it.