@AfterClass public void finalAssert(){ SoftAssert softAssert = new SoftAssert(); softAssert.assertTrue(orderOfExecution.contains("test1 wayToName"), "group 'first' was not grouped"); softAssert.assertTrue(orderOfExecution.contains("originalName thisOne"), "group 'third' was not grouped"); softAssert.assertTrue(orderOfExecution.contains("coveredByTests treatThisRight"), "group 'second' was not grouped"); softAssert.assertAll(); }
@Test public void testSoftAssert() { SoftAssert s = new SoftAssert(); s.assertEquals(2 * 2, 3, "Three"); s.assertEquals(2 * 2, 5, "Five"); s.assertAll(); }
@Test public void selectCategoryAndTopic() { WebDriver driver = null; SoftAssert softAssert = new SoftAssert(); try { driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); driver.manage().window().maximize(); driver.get("http://automated-testing.info"); SamplePage samplePage = new SamplePage(driver) .selectCategoryByName("webdriver") .selectTopicByIndex(1); softAssert.assertEquals(samplePage.getCurrentCategory(), "webdriver", "Wrong category"); softAssert.assertEquals(samplePage.getTopicCreator(), "val_ch", "Wrong topic starter"); softAssert.assertAll(); } catch (Exception e) { e.printStackTrace(); } finally { if (driver != null) { driver.quit(); } } }
@BeforeMethod public void startTest() { softAssert = new SoftAssert(); }
@BeforeMethod public void start(){ softAssert = new SoftAssert(); generateCssSelector = WebLocatorConfig.isGenerateCssSelector(); WebLocatorConfig.setGenerateCssSelector(true); }