1

我是新来的 :)。我现在正在使用 thucydides v. 0.9.203 和 htmelements v. 1.9 和 chromedriver v. 2.30.0 编写自己的测试框架,并且在驱动程序和 thucydides 之间存在兼容性问题。请在下面找到我的 pom.xml 文件,我在哪里做错了?

 <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <thucydides.version>0.9.203</thucydides.version>
    <webdriver.chrome.driver>chrome</webdriver.chrome.driver>
    <maven.test.failure.ignore>true</maven.test.failure.ignore>
    <htmlelements.version>1.9</htmlelements.version>
    <testSourceDirectory>src/test/java</testSourceDirectory>
</properties>
<dependencies>
    <dependency>
        <groupId>net.thucydides</groupId>
        <artifactId>thucydides-core</artifactId>
        <version>${thucydides.version}</version>
    </dependency>
    <dependency>
        <groupId>net.thucydides</groupId>
        <artifactId>thucydides-junit</artifactId>
        <version>${thucydides.version}</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.21</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.htmlelements</groupId>
        <artifactId>htmlelements-matchers</artifactId>
        <version>${htmlelements.version}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-chrome-driver</artifactId>
        <version>2.30.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-exec</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.properties</groupId>
        <artifactId>properties-loader</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.htmlelements</groupId>
        <artifactId>htmlelements-thucydides</artifactId>
        <version>1.11</version>
    </dependency>
    <dependency>
        <groupId>ru.yandex.qatools.htmlelements</groupId>
        <artifactId>htmlelements-java</artifactId>
        <version>${htmlelements.version}</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
            <configuration>
                <systemPropertyVariables>
                    <webdriver.driver>chrome</webdriver.driver>
                </systemPropertyVariables>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.thucydides.maven.plugins</groupId>
            <artifactId>maven-thucydides-plugin</artifactId>
            <version>${thucydides.version}</version>
            <executions>
                <execution>
                    <id>thucydides-reports</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

此外,我Exception在运行测试时有这个:

Failed to instantiate page of type class com.epam.frameworks.thusydides.basics.pages.FilteringPage (null)

下面有 FilteringPage 和 Steps 代码:

public class FilteringPage extends PageObject {

    public FilteringPage(WebDriver driver) {
        super(driver);
    }

    public FilterBlock filterBlock;
}

public class FilterBlockSteps extends ScenarioSteps {

    public FilterBlockSteps(Pages pages){
        super(pages);
    }

    private FilteringPage onFilteringPage(){
        return pages().get(FilteringPage.class);
    }

    @Step("Ввод начальной цены {0}")
    public void setFilterStartPrice(String price) {
        onFilteringPage().filterBlock.priceFrom.sendKeys(price);
    }

    @Step("Ввод конечной цены {0}")
    public void setFilterFinishPrice(String price) {
        onFilteringPage().filterBlock.priceTo.sendKeys(price);
    }

    @StepGroup
    public void filtering(String priceFrom, String priceTo){
        setFilterStartPrice(priceFrom);
        setFilterFinishPrice(priceTo);
    }
}
4

0 回答 0