Java Code Examples for com.aventstack.extentreports.ExtentReports#createTest()
The following examples show how to use
com.aventstack.extentreports.ExtentReports#createTest() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReportEntityTest.java From extentreports-java with Apache License 2.0 | 6 votes |
@org.testng.annotations.Test public void exceptionContext() { String msg = "An exception has occurred."; RuntimeException ex = new RuntimeException(msg); ExtentReports extent = extent(); ExtentTest test = extent.createTest("Test"); NamedAttributeContextManager<ExceptionInfo> context = extent.getReport().getExceptionInfoCtx(); Assert.assertFalse(context.hasItems()); test.fail(ex); test.assignDevice("x"); Assert.assertTrue(context.hasItems()); Assert.assertTrue( context.getSet().stream().anyMatch(x -> x.getAttr().getName().equals("java.lang.RuntimeException"))); Assert.assertTrue(context.getSet().stream().anyMatch(x -> x.getTestList().size() == 1)); Assert.assertTrue(context.getSet().stream() .flatMap(x -> x.getTestList().stream()) .anyMatch(x -> x.getName().equals("Test"))); }
Example 2
Source File: GherkinKeywordTest.java From extentreports-java with Apache License 2.0 | 6 votes |
@Test public void testEnglishGherkinKeywords() throws ClassNotFoundException, UnsupportedEncodingException { ExtentReports extent = extent(); extent.setGherkinDialect("en"); ExtentTest feature = extent.createTest(new GherkinKeyword("Feature"), "Refund item VM"); ExtentTest scenario = feature.createNode(new GherkinKeyword("Scenario"), "Jeff returns a faulty microwave"); ExtentTest given = scenario.createNode(new GherkinKeyword("Given"), "Jeff has bought a microwave for $100").skip("skip"); ExtentTest and = scenario.createNode(new GherkinKeyword("And"), "he has a receipt").pass("pass"); ExtentTest when = scenario.createNode(new GherkinKeyword("When"), "he returns the microwave").pass("pass"); ExtentTest then = scenario.createNode(new GherkinKeyword("Then"), "Jeff should be refunded $100").skip("skip"); Assert.assertEquals(feature.getModel().getBddType(), Feature.class); Assert.assertEquals(scenario.getModel().getBddType(), Scenario.class); Assert.assertEquals(given.getModel().getBddType(), Given.class); Assert.assertEquals(and.getModel().getBddType(), And.class); Assert.assertEquals(when.getModel().getBddType(), When.class); Assert.assertEquals(then.getModel().getBddType(), Then.class); }
Example 3
Source File: GherkinKeywordTest.java From extentreports-java with Apache License 2.0 | 6 votes |
@Test public void testGermanGherkinKeywords() throws ClassNotFoundException, UnsupportedEncodingException { ExtentReports extent = extent(); extent.setGherkinDialect("de"); ExtentTest feature = extent.createTest(new GherkinKeyword("Funktionalität"), "Refund item VM"); ExtentTest scenario = feature.createNode(new GherkinKeyword("Szenario"), "Jeff returns a faulty microwave"); ExtentTest given = scenario.createNode(new GherkinKeyword("Angenommen"), "Jeff has bought a microwave for $100").skip("skip"); ExtentTest and = scenario.createNode(new GherkinKeyword("Und"), "he has a receipt").pass("pass"); ExtentTest when = scenario.createNode(new GherkinKeyword("Wenn"), "he returns the microwave").pass("pass"); ExtentTest then = scenario.createNode(new GherkinKeyword("Dann"), "Jeff should be refunded $100").skip("skip"); Assert.assertEquals(feature.getModel().getBddType(), Feature.class); Assert.assertEquals(scenario.getModel().getBddType(), Scenario.class); Assert.assertEquals(given.getModel().getBddType(), Given.class); Assert.assertEquals(and.getModel().getBddType(), And.class); Assert.assertEquals(when.getModel().getBddType(), When.class); Assert.assertEquals(then.getModel().getBddType(), Then.class); }
Example 4
Source File: ReportEntityTest.java From extentreports-java with Apache License 2.0 | 5 votes |
@org.testng.annotations.Test public void authorCtx() { ExtentReports extent = extent(); ExtentTest test = extent.createTest("Test"); NamedAttributeContextManager<Author> context = extent.getReport().getAuthorCtx(); Assert.assertFalse(context.hasItems()); test.assignAuthor("x"); Assert.assertTrue(context.hasItems()); Assert.assertTrue(context.getSet().stream().anyMatch(x -> x.getAttr().getName().equals("x"))); Assert.assertTrue(context.getSet().stream().anyMatch(x -> x.getTestList().size() == 1)); Assert.assertTrue(context.getSet().stream() .flatMap(x -> x.getTestList().stream()) .anyMatch(x -> x.getName().equals("Test"))); }
Example 5
Source File: ReportEntityTest.java From extentreports-java with Apache License 2.0 | 5 votes |
@org.testng.annotations.Test public void categoryCtx() { ExtentReports extent = extent(); ExtentTest test = extent.createTest("Test"); NamedAttributeContextManager<Category> context = extent.getReport().getCategoryCtx(); Assert.assertFalse(context.hasItems()); test.assignCategory("x"); Assert.assertTrue(context.hasItems()); Assert.assertTrue(context.getSet().stream().anyMatch(x -> x.getAttr().getName().equals("x"))); Assert.assertTrue(context.getSet().stream().anyMatch(x -> x.getTestList().size() == 1)); Assert.assertTrue(context.getSet().stream() .flatMap(x -> x.getTestList().stream()) .anyMatch(x -> x.getName().equals("Test"))); }
Example 6
Source File: ReportEntityTest.java From extentreports-java with Apache License 2.0 | 5 votes |
@org.testng.annotations.Test public void deviceCtx() { ExtentReports extent = extent(); ExtentTest test = extent.createTest("Test"); NamedAttributeContextManager<Device> context = extent.getReport().getDeviceCtx(); Assert.assertFalse(context.hasItems()); test.assignDevice("x"); Assert.assertTrue(context.hasItems()); Assert.assertTrue(context.getSet().stream().anyMatch(x -> x.getAttr().getName().equals("x"))); Assert.assertTrue(context.getSet().stream().anyMatch(x -> x.getTestList().size() == 1)); Assert.assertTrue(context.getSet().stream() .flatMap(x -> x.getTestList().stream()) .anyMatch(x -> x.getName().equals("Test"))); }
Example 7
Source File: ExtentReportsBuilder.java From courgette-jvm with MIT License | 4 votes |
private ExtentTest createBddTest(ExtentReports extentReports, String featureName) { ExtentTest featureNode = extentReports.createTest(featureName); featureNode.getModel().setBddType(com.aventstack.extentreports.gherkin.model.Feature.class); return featureNode; }