Не могу запустить тест в Безмятежности - PullRequest
0 голосов
/ 06 марта 2019

Я новичок в мире автоматизации тестирования, поэтому у меня возникла проблема при выполнении теста Serenity.Я использую Serenity с Cucumber и JUnit в проекте Maven, в котором есть Vaadin и JPA.С mvn verify я получаю: enter image description here

Затем я попытался изменить переменные среды, думая, что это может быть проблемой. enter image description here

Но ничего не происходит в том же сообщении об ошибке.Это мой файл 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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.vaadin.demo</groupId>
<artifactId>jpacontainer-addressbook-demo</artifactId>
<version>4.0.0</version>
<packaging>war</packaging>
<name>Simple Vaadin JPAContainer example app</name>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <vaadin.version>8.0.0</vaadin.version>
    <maven.compiler.target>1.9</maven.compiler.target>
    <maven.compiler.source>1.9</maven.compiler.source>
    <serenity.version>1.0.47</serenity.version>
    <serenity.maven.version>1.0.47</serenity.maven.version>
    <webdriver.driver>chrome</webdriver.driver>
    <webdriver.chrome.driver>C:\Users\Sany\Desktop\asignaturs3\2 cuatri\GPS\chromedriver.exe</webdriver.chrome.driver>
</properties>

<organization>
    <name>Vaadin Ltd</name>
    <url>http://vaadin.com/</url>
</organization>
<inceptionYear>2009</inceptionYear>
<url>http://vaadin.com/</url>
<scm>
    <connection>scm:svn:http://dev.vaadin.com/svn/addons/JPAContainer/trunk</connection>
    <developerConnection>scm:svn:http://dev.vaadin.com/svn/addons/JPAContainer/trunk</developerConnection>
    <url>http://dev.vaadin.com/browser/addons/JPAContainer/trunk</url>
</scm>
<issueManagement>
    <system>trac</system>
    <url>http://dev.vaadin.com/</url>
</issueManagement>
<developers>
    <developer>
        <name>Petter Holmström</name>
        <id>petter</id>
        <email>petter at vaadin.com</email>
        <organization>Vaadin Ltd</organization>
        <timezone>+2</timezone>
    </developer>
    <developer>
        <name>Henri Sara</name>
        <id>hesara</id>
        <email>hesara at vaadin.com</email>
        <organization>Vaadin Ltd</organization>
        <timezone>+2</timezone>
    </developer>
</developers>

<licenses>
    <license>
        <name>Apache License version 2.0</name>
        <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
        <distribution>repo</distribution>
    </license>
</licenses>

<repositories>
    <repository>
        <id>EclipseLink Repo</id>
        <url>http://www.eclipse.org/downloads/download.php?r=1&amp;nf=1&amp;file=/rt/eclipselink/maven.repo</url>
    </repository>
    <repository>
        <id>vaadin-addons</id>
        <url>http://maven.vaadin.com/vaadin-addons</url>
    </repository>
    <repository>
        <id>vaadin-snapshots</id>
        <name>Vaadin snapshot repository</name>
        <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-compatibility-server</artifactId>
        <version>${vaadin.version}</version>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-client-compiled</artifactId>
        <version>${vaadin.version}</version>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-themes</artifactId>
        <version>${vaadin.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.3</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.vaadin.addon</groupId>
        <artifactId>jpacontainer</artifactId>
        <version>${project.version}</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>eclipselink</artifactId>
        <version>2.2.0</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>javax.persistence</artifactId>
        <version>2.0.0</version>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.3.160</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.2.0.Final</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.6</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.vaadin/vaadin-core -->
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-core</artifactId>
        <version>12.0.7</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <version>7.2.1.jre8</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-core -->
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-core</artifactId>
        <version>2.0.40</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-junit -->
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>2.0.40</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-model -->
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-model</artifactId>
        <version>2.0.40</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-screenplay -->
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-screenplay</artifactId>
        <version>2.0.40</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-cucumber -->
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-cucumber</artifactId>
        <version>1.9.31</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/junit/junit -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>1.7.0</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-stats</artifactId>
        <version>2.0.40</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-screenplay-webdriver</artifactId>
        <version>2.0.40</version>
    </dependency>

    <dependency>
        <groupId>net.serenity-bdd</groupId>     
        <artifactId>core</artifactId>
        <version>${serenity.version}</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>     
        <artifactId>serenity-junit</artifactId>
        <version>${serenity.version}</version>
    </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-M3</version>
    </dependency>



</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>com.mycila.maven-license-plugin</groupId>
            <artifactId>maven-license-plugin</artifactId>
            <version>1.9.0</version>
            <configuration>
                <basedir>${basedir}</basedir>
                <header>${basedir}/../java-license-header.txt</header>
                <quiet>false</quiet>
                <failIfMissing>true</failIfMissing>
                <aggregate>false</aggregate>
                <useDefaultExcludes>true</useDefaultExcludes>
                <useDefaultMapping>true</useDefaultMapping>
                <encoding>UTF-8</encoding>
                <properties>
                    <year>2009-2013</year>
                </properties>
                <excludes>
                    <exclude>*/target/**</exclude>
                    <exclude>*/doc/**</exclude>
                    <exclude>**/*.xml</exclude>
                    <exclude>**/README</exclude>
                    <exclude>**/LICENSE</exclude>
                </excludes>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>format</goal>
                    </goals>
                </execution>
                <execution>
                    <id>check-headers</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>check</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
        </plugin>

        <plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.2</version>
        </plugin>

        <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>                  
            <version>2.18</version>
            <configuration>
                <includes>
                    <include>**/features/**/When*.java</include>                  
                </includes>
                <systemProperties>
                    <webdriver.driver>${webdriver.driver}</webdriver.driver> 
                    <surefire.rerunFailingTestsCount>${surefire.rerunFailingTestsCount}</surefire.rerunFailingTestsCount>
                    <surefire.rerunFailingTestsCount>${surefire.rerunFailingTestsCount}</surefire.rerunFailingTestsCount>
                </systemProperties>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>       
            <artifactId>serenity-maven-plugin</artifactId>
            <version>${serenity.maven.version}</version>
            <dependencies>
                 <dependency>
                    <groupId>net.serenity-bdd</groupId>
                    <artifactId>core</artifactId>
                    <version>${serenity.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>serenity-reports</id>
                    <phase>post-integration-test</phase>             
                    <goals>
                        <goal>aggregate</goal>                       
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
           <version>3.0.0-M3</version>
           <configuration>
              <testFailureIgnore>true</testFailureIgnore>
           </configuration>
        </plugin>
    </plugins>
</build>

Также я попытался с помощью: mvn test verify - Dwebdriver.chrome.driver = C: \ Users \ Sany \ Desktop \ asignaturs3 \ 2cuatri \ GPS \ chromedri ver.exe - Dwebdriver.driver = chrome This is the message that I get

Я также пробовал с помощью: агрегат безмятежности mvn.Здесь его удается построить, но я получаю пустой отчет.

Вот все мои классы, относящиеся к Serenity и Cucumber:

Я получаю этот класс после урока, я действительно не знаю, чтоэто примерно.

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features="tests/serenity/features")
public class Runner {

}

Мои определения шагов:

public class TestPrototypeStepDefinitions {

@Steps
PrototypeSteps proto;

@Managed
WebDriver driver;

@Given("I want to see my name on the page")
public void testUserWantsToSeeHisName() {
    proto.openHomePage();
}

@When("I fill the field for name with '(.*)'")
public void fillTheFieldWithName(String string) {
    proto.fillName(string);
}

@And("click Save button and click Show all inserted names button")
public void clickSaveAndShowAll() {
    proto.clickSaveBtn();
    proto.clickShowAll();
}

@Then("Then I should see my name in the list")
public void seeMyName() {

}

}

Мои шаги:

public class PrototypeSteps {
HomePage hPage;

@Step
public void openHomePage() {
    hPage.open();
}

@Step
public void fillName(String name) {
    hPage.fillNameField(name);
}

@Step
public void clickSaveBtn() {
    hPage.clickSaveNameBtn();
}

@Step
public void clickShowAll() {
    hPage.clickShowAllBtn();
}
}

Объект моей страницы:

@DefaultUrl("https://prototipofinalha.azurewebsites.net/")  
public class HomePage extends PageObject{

@FindBy(css = "#ROOT-2521314-overlays > div.v-window.v-widget.v-has-width.v- 
has-height > div > div > div.v-window-contents > div > div > div > div > div >  div:nth-child(1) > div > div:nth-child(3) > input")
WebElement nameFiled;

@FindBy(xpath = "//*[@id=\"ROOT-2521314-overlays\"]/div[1]/div/div/div[3]/div/div/div/div/div/div[1]/div/div[5]/div")
WebElement saveBtn;

@FindBy(xpath = "//*[@id=\"ROOT-2521314-overlays\"]/div[1]/div/div/div[3]/div/div/div/div/div/div[3]/div/div/div/div[3]/div")
WebElement showAllBtn;

public HomePage fillNameField(String name) {
    this.nameFiled.sendKeys(name);
    return this;
}

public HomePage clickSaveNameBtn() {
    this.saveBtn.click();
    return this;
}

public HomePage clickShowAllBtn() {
    this.showAllBtn.click();
    return this;
}

}

Наконец мой сценарий с корнишоном:

 Feature: Name

 As a test scenario user
 I want to be able to save my name
 In order to have my name saved in the programme

 Scenario: Should save the given name and list all inserted
 Given I want to see my name on the page
 When I fill the field for name with 'name' 
 And click Save button and click Show all inserted names button 

Я знаю, что это много кода и текста, но я не уверен, где может быть проблема или что я делаю неправильно.Спасибо за ваше время.

...