public void WhenAction2() { try { webutil.selectTshirts(); extent1.SetStepStatusPass("WHEN the user searches tshirt & pays for it"); } catch (Exception e) { Console.WriteLine("Handled excpetion -" + e.ToString()); extent1.SetStepStatusFail("WHEN the user searches tshirt & pays for it"); } }
public void WhenAction1() { try { webutil.selectTshirts(); extent1.SetStepStatusPass("WHEN the user clicks on the Name and updates first name"); } catch (Exception e) { Console.WriteLine("Handled excpetion -" + e.ToString()); extent1.SetStepStatusFail("WHEN the user clicks on the Name and updates first name"); } }
public void ThenTestableOutcome1() { //test data has to be parametersied //string expectedTitle="Scottish Widows | Pensions | Life insurance | Investments1"; //have to think something about test data record & steps mapping class string expectedTitle = json.GetTestDataValue(1, "ExpectedPageTitle"); bool result1 = webutil.ValidatePageTitle(expectedTitle); if (result1 == true) { extent1.SetStepStatusPass("THEN the guest user should be able to see the Scottish Widows Home Page"); extent1.SetTestStatusPass(); } else { extent1.SetStepStatusFail("THEN the guest user should be able to see the Scottish Widows Home Page"); extent1.SetTestStatusFail("The actual page title: '" + webutil.GetPageTitle() + "' is not same as the expected page title:'" + expectedTitle + "' "); } extent1.Close(); }
public void ThenTestableOutcome1() { bool bRes = false; //please update the search text here accoding to api under test //we will have to discuss to check how to approach asserts & test passing and failing decision , I personally go with the boolean approach //keeping the variable failed as long as we have not done the final validations to make it true bRes = p1.ValidatePresenceOfText("Welcome to my rest assured project"); //extent1.CreateTest(TestContext.CurrentContext.Test.Name); if (bRes == true) { extent1.SetStepStatusPass("Then the user should get desired response"); extent1.SetTestStatusPass(); } else { extent1.SetStepStatusFail("Then the user should get desired response"); extent1.SetTestStatusFail("The searched text is not present in the response body"); } extent1.Close();//to flush and close the extent report }