diff --git a/pom.xml b/pom.xml index f999194..b111949 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ UTF-8 1.8 1.8 - 9.0-SNAPSHOT + 12.0.0 1.8.10 @@ -43,6 +43,11 @@ ${pf2.version} jar + + io.qameta.allure + allure-junit4 + 2.10.0 + @@ -55,6 +60,12 @@ -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" -Dcucumber.options="--plugin io.qameta.allure.cucumber2jvm.AllureCucumber2Jvm --plugin pretty" + + + listener + io.qameta.allure.junit4.AllureJunit4 + + diff --git a/src/test/java/ru/sbtqa/tag/pagefactory2example/JunitTest.java b/src/test/java/ru/sbtqa/tag/pagefactory2example/JunitTest.java index f113261..cad8e57 100644 --- a/src/test/java/ru/sbtqa/tag/pagefactory2example/JunitTest.java +++ b/src/test/java/ru/sbtqa/tag/pagefactory2example/JunitTest.java @@ -4,8 +4,10 @@ import org.junit.BeforeClass; import org.junit.Test; import ru.sbtqa.tag.pagefactory.exceptions.PageException; -import ru.sbtqa.tag.stepdefs.CoreSetupSteps; -import ru.sbtqa.tag.stepdefs.WebSteps; +import ru.sbtqa.tag.pagefactory.exceptions.PageInitializationException; +import ru.sbtqa.tag.pagefactory.junit.CoreSetupSteps; +import ru.sbtqa.tag.pagefactory.web.junit.WebSteps; +import ru.sbtqa.tag.pagefactory2example.junit.ExampleSteps; public class JunitTest { @@ -28,6 +30,11 @@ public void webTestTitles() throws PageException, NoSuchMethodException { .checkValueIsEqual("Text", "Тестовый текст для примера"); } + @Test + public void testOwnMethod() throws PageInitializationException { + ExampleSteps.getInstance().openPage("Test Automation Gears").exampleMethod("parameterName"); + } + @AfterClass public static void after() { CoreSetupSteps.tearDown(); diff --git a/src/test/java/ru/sbtqa/tag/pagefactory2example/junit/ExampleSteps.java b/src/test/java/ru/sbtqa/tag/pagefactory2example/junit/ExampleSteps.java new file mode 100644 index 0000000..bcfe08d --- /dev/null +++ b/src/test/java/ru/sbtqa/tag/pagefactory2example/junit/ExampleSteps.java @@ -0,0 +1,13 @@ +package ru.sbtqa.tag.pagefactory2example.junit; + +public class ExampleSteps extends ExampleStepsImpl { + + private static ExampleSteps instance; + + public static ExampleSteps getInstance() { + if (instance == null) { + instance = new ExampleSteps(); + } + return instance; + } +} diff --git a/src/test/java/ru/sbtqa/tag/pagefactory2example/junit/ExampleStepsImpl.java b/src/test/java/ru/sbtqa/tag/pagefactory2example/junit/ExampleStepsImpl.java new file mode 100644 index 0000000..065b984 --- /dev/null +++ b/src/test/java/ru/sbtqa/tag/pagefactory2example/junit/ExampleStepsImpl.java @@ -0,0 +1,12 @@ +package ru.sbtqa.tag.pagefactory2example.junit; + +import io.qameta.allure.Step; +import ru.sbtqa.tag.pagefactory.html.junit.HtmlStepsImpl; + +public class ExampleStepsImpl> extends HtmlStepsImpl { + + @Step("Мой тестовый метод \"{parameter}\"") + public T exampleMethod(String parameter) { + return (T) this; + } +}