public void PrintKeyAndValue(WriterLog wLogIn) throws ExceptFailTest { WriterLog wLog = wLogIn; for (Map.Entry<K, V> me : s) { wLog.WriteString(1, me.getKey() + " = " + me.getValue()); System.out.println(me.getKey() + " = " + me.getValue()); } }
@BeforeTest public void befTest() throws ExceptFailTest { System.out.println("Start @BeforeTest"); testR = new ResultTest(); wLog = new WriterLog(); wLog.SetUpWriterLog("Log_Result.html"); lthe.GetWritterLog(wLog); System.out.println("End @BeforeTest"); };
@Test public void TestStart() throws ExceptFailTest { System.out.println("Start @Test"); try { pageLoginStargate.GetWriterLog(wLog); // отдали лог pageLoginStargate.OpenPage(); pageLoginStargate.CheckElements(); pageLoginStargate.TypeLoginPassword(); pageStargate = pageLoginStargate.EnterStargate(); pageStargate.GetWriterLog(wLog); if (Proper.GetProperty("typeAdvert").equals("premium")) pageStargate.OpenFormCreatePremiumAuto(); else pageStargate.OpenFormCreateAdvertAuto(); pageStargate.InputDataAuto(); if (Proper.GetProperty("typeAdvert").equals("premium")) pageStargate.OpenFormCreatePremiumFree(); else pageStargate.OpenFormCreateAdvertFree(); pageStargate.InputDataFree(); pageIrr.GetWriterLog(wLog); pageIrr.OpenPage(); pageIrr.OpenFormAuthorization(); pageIrrPrOf = pageIrr.LoginOn(); pageIrrPrOf.GetWriterLog(wLog); pageIrrPrOf.CheckCountAndVisibleAdvert(); pageIrrPrOf.CheckCurrentCategory(); pageIrrPrOf.GetCurrentStatus(); pageIrrPrOf.GetCurrentCategory(); pageIrrPrOf.DeactivateAllAdvert(); pageIrrPrOf.CheckCountAndVisibleAdvert(); pageIrrPrOf.CheckCurrentCategory(); pageIrrPrOf.CheckOldAndNewStatus(1); pageIrrPrOf.CheckOldAndNewCategory(1); pageIrrPrOf.DeleteAllAdvert(); pageIrrPrOf.CheckCountAndVisibleAdvert(); pageIrrPrOf.CheckCurrentCategory(); pageIrrPrOf.CheckOldAndNewStatus(2); clStatusAdvert = pageIrrPrOf.SendStatus(); clStatusAdvertCategory = pageIrrPrOf.SendCategory(); pageIrrPrOf.LogOutFromIrr(); pageLoginStargate.OpenPage(); pageLoginStargate.CheckElements(); pageLoginStargate.TypeLoginPassword(); pageStargate = pageLoginStargate.EnterStargate(); pageStargate.GetWriterLog(wLog); if (Proper.GetProperty("typeAdvert").equals("premium")) pageStargate.OpenFormCreatePremiumAuto(); else pageStargate.OpenFormCreateAdvertAuto(); pageStargate.InputDataAuto(); if (Proper.GetProperty("typeAdvert").equals("premium")) pageStargate.OpenFormCreatePremiumFree(); else pageStargate.OpenFormCreateAdvertFree(); pageStargate.InputDataFree(); pageIrr.OpenPage(); pageIrr.OpenFormAuthorization(); pageIrrPrOf = pageIrr.LoginOn(); pageIrrPrOf.GetWriterLog(wLog); pageIrrPrOf.GetStatusForLastLogin(clStatusAdvert, clStatusAdvertCategory); pageIrrPrOf.CheckCountAndVisibleAdvert(); pageIrrPrOf.CheckCurrentCategory(); pageIrrPrOf.CheckOldAndNewStatus(3); pageIrrPrOf.CheckOldAndNewCategory(2); System.out.println("Тест завершен успешно"); wLog.WriteString(1, "Тест завершен успешно"); } catch (ExceptFailTest exc) { System.out.println("Что то случилось непредвиденное 2" + exc.toString()); wLog.WriteString(2, "Что то случилось непредвиденное 2: " + exc.toString()); fail("some error here2"); // testR.SetFlag(false); } catch (Exception exc) { System.out.println("Что то случилось непредвиденное" + exc.toString()); wLog.WriteString(2, "Что то случилось непредвиденное: " + exc.toString()); fail("some error here"); // testR.SetFlag(false); // throw new ExceptFailTest(exc.toString()); } finally { CaptureScreenshot(); wLog.CloseFile(); driver.quit(); } System.out.println("End @Test"); }