Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Junit #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<pf2.version>9.0-SNAPSHOT</pf2.version>
<pf2.version>12.0.0</pf2.version>
<aspectj.version>1.8.10</aspectj.version>
</properties>
<dependencies>
Expand Down Expand Up @@ -43,6 +43,11 @@
<version>${pf2.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit4</artifactId>
<version>2.10.0</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand All @@ -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"
</argLine>
<properties>
<property>
<name>listener</name>
<value>io.qameta.allure.junit4.AllureJunit4</value>
</property>
</properties>
</configuration>
<dependencies>
<dependency>
Expand Down
11 changes: 9 additions & 2 deletions src/test/java/ru/sbtqa/tag/pagefactory2example/JunitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package ru.sbtqa.tag.pagefactory2example.junit;

public class ExampleSteps extends ExampleStepsImpl<ExampleSteps> {

private static ExampleSteps instance;

public static ExampleSteps getInstance() {
if (instance == null) {
instance = new ExampleSteps();
}
return instance;
}
}
Original file line number Diff line number Diff line change
@@ -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<T extends ExampleStepsImpl<T>> extends HtmlStepsImpl<T> {

@Step("Мой тестовый метод \"{parameter}\"")
public T exampleMethod(String parameter) {
return (T) this;
}
}