Не могу сформировать Allure отчет в своем автотесте.
Запускаю выполнение автотеста с помощью junit: при выполнении не создается папка allure-results и получаю следующие ошибки:
10:18:53.917 [main] ERROR io.qameta.allure.AllureLifecycle - Could not start step: no test case running
10:18:54.316 [main] ERROR io.qameta.allure.AllureLifecycle - Could not update step: no step running
10:18:54.316 [main] ERROR io.qameta.allure.AllureLifecycle - Could not stop step: no step running
10:18:54.317 [main] ERROR io.qameta.allure.AllureLifecycle - Could not start step: no test case running
10:18:54.387 [main] ERROR io.qameta.allure.AllureLifecycle - Could not update step: no step running
10:18:54.387 [main] ERROR io.qameta.allure.AllureLifecycle - Could not stop step: no step running
При запуске с помощью maven, получаю следующий ворнинг:
[ERROR] Directory C:\git\etc_test\target\allure-results not found.
[WARNING] Allure report was skipped because there is no results directories found.
Если я создаю папку allure-results вручную, то при исполнении mvn удалит ее и вернет тот же самый ворнинг.
Мой pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ru.mos</groupId>
<artifactId>etc_test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<aspectj.version>1.8.10</aspectj.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.0-RC1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.0-RC1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.8.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5</artifactId>
<version>2.13.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/1.8.10/aspectjweaver-1.8.10.jar"
</argLine>
<properties>
<property>
<name>listener</name>
<value>io.qameta.allure.junit5.AllureJunit5</value>
</property>
</properties>
<systemProperties>
<property>
<name>allure.results.directory</name>
<value>${project.build.directory}/allure-results</value>
</property>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.10</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.10.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Структура теста: TestCase5986:
package ru.mos;
import io.qameta.allure.*;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class TestCase5986 {
public static LoginPage loginPage;
public static MainPage mainPage;
public static WblPage wblPage;
public static WebDriver driver;
@BeforeClass
public static void setup() {
System.setProperty("webdriver.chrome.driver", ConfProperties.getProperty("chromedriver"));
driver = new ChromeDriver();
loginPage = new LoginPage(driver);
mainPage = new MainPage(driver);
wblPage = new WblPage(driver);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(ConfProperties.getProperty("loginpage"));
}
@Epic("Тестирование стенда ETC)
@Feature(value = "CASE-5986")
@Severity(SeverityLevel.CRITICAL)
@Description("Позитивный тест формы логирования в системе")
@Story (value = "Авторизация с корректным логином")
@Test
public void LoginTest() {
loginPage.inputLogin(ConfProperties.getProperty("login"), ConfProperties.getProperty("password"));
loginPage.clickSubmitBtn();
/*mainPage.waybillListClick();
wblPage.createBtnClick();
wblPage.carSelect();
wblPage.createMission();
wblPage.techOpIdSelect();
wblPage.facilityIdSelect();
wblPage.routeIdSelect();
wblPage.missionSubmitClick();
wblPage.refillAddRow1();
wblPage.oneFuelTankContSelect();
wblPage.depDateFieldInput();
wblPage.arrivalDateFieldInput();
wblPage.newDepDate();
assert wblPage.checkErrorMsg();*/
}
@AfterClass
public static void driverClose () {
driver.close();
}
}
loginPage:
package ru.mos;
import io.qameta.allure.Step;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class LoginPage {
public WebDriver driver;
public LoginPage(WebDriver driver) {
PageFactory.initElements(driver, this);
this.driver = driver;
}
@FindBy(id = "login")
public WebElement loginFld;
@FindBy(id = "password")
public WebElement passwordFld;
@FindBy(id = "submit")
public WebElement submitBtn;
@Step("Ввод логина {login} и пароля {password}")
public void inputLogin(String login, String password) {
loginFld.sendKeys(login);
passwordFld.sendKeys(password);
}
@Step ("Подтверждение авторизации")
public void clickSubmitBtn() {
submitBtn.click();
}
}
У меня два предположения:
- чего-то не хватает в pom.xml;
- некорректное использование аннотаций.
UPD: При выполнении команды allure:serve формируется пустой отчет:
UPD2: Лог Maven при выполнении кейса:
C:\jdk1.8.0_161\bin\java.exe -Dmaven.multiModuleProjectDirectory=C:\git\TestNGAllure_test "-Dmaven.home=C:\Users\TinkovAY\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2020.2\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Users\TinkovAY\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2020.2\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=C:\Users\TinkovAY\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2020.2\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\Users\TinkovAY\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2020.2\lib\idea_rt.jar=52132:C:\Users\TinkovAY\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2020.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\TinkovAY\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2020.2\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar;C:\Users\TinkovAY\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2020.2\plugins\maven\lib\maven3\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.version=2020.2.1 clean test -Dsuite=src/test/resources/testng.xml.xml -Dversion=83.0 allure:serve
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< ru.dit:TestNGAllure_test >----------------------
[INFO] Building TestNGAllure_test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ TestNGAllure_test ---
[INFO] Deleting C:\git\TestNGAllure_test\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ TestNGAllure_test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ TestNGAllure_test ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ TestNGAllure_test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ TestNGAllure_test ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to C:\git\TestNGAllure_test\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.20:test (default-test) @ TestNGAllure_test ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.034 s - in TestSuite
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- allure-maven:2.10.0:serve (default-cli) @ TestNGAllure_test ---
[INFO] Allure installation directory C:\git\TestNGAllure_test/.allure
[INFO] Try to finding out allure 2.8.1
[INFO] Generate Allure report (serve) with version 2.8.1
[INFO] Generate Allure report to C:\git\TestNGAllure_test\target\site/allure-maven-plugin
[INFO] Found results directory C:\git\TestNGAllure_test\target\allure-results
[INFO] Can't find information about categories.
[INFO] Generate report to C:\git\TestNGAllure_test\target\site\allure-maven-plugin
Generating report to temp directory...
Report successfully generated to C:\Users\TinkovAY\AppData\Local\Temp\6365362014998145974\allure-report
Starting web server...
2020-08-26 15:35:45.363:INFO::main: Logging initialized @2065ms to org.eclipse.jetty.util.log.StdErrLog
Server started at <http://10.159.209.98:52175/>. Press <Ctrl+C> to exit
Структура проекта
@Epic("Тестирование стенда ETC)
- нет закрывающих кавычек. Также, у Вас в pom.xml сразу и JUnit 4 и JUnit 5 объявленыmaven
-а не соотвествует указанномуpom.xml
(-Dsuite=src/test/resources/testng.xml.xml
). Можете привести пример запускаmaven
с использованиемJUnit 5
?