1

我到处寻找答案。看来修昔底德的文档非常有限和/或他们没想到人们会这么早就遇到问题。我主要关注有这个过程的http://thucydides.info/docs/thucydides-one-page/thucydides.html 。

我通过创建一个新项目

mvn archetype:generate

并选择net.thucydides:thucydides-simple-archetype

安装后,我去我settings.xml所在的位置/home/user/.m2/settings.xml并输入:

<pluginGroups>
  <pluginGroup>net.thucydides.maven.plugins</pluginGroup>
</pluginGroups>

并运行

mvn test thucydides:aggregate

我得到:

[INFO] ------------------------------------------------------------------------
[INFO] Building Sample Thucydides project 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ .thucydides ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /opt/AM_Thucydides/thucydides/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ .thucydides ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ .thucydides ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /opt/AM_Thucydides/thucydides/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ .thucydides ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12:test (default-test) @ .thucydides ---
[INFO] Tests are skipped.
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Sample Thucydides project 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-thucydides-plugin:0.9.229:aggregate (default-cli) @ .thucydides ---
[INFO] LOADING LOCAL THUCYDIDES PROPERTIES FROM /home/user/thucydides.properties 
[INFO] LOADING LOCAL THUCYDIDES PROPERTIES FROM /opt/AM_Thucydides/thucydides/thucydides.properties 
[INFO] LOADING LOCAL THUCYDIDES PROPERTIES FROM /opt/AM_Thucydides/thucydides/thucydides.properties 
[INFO] Using requirements providers: [net.thucydides.core.statistics.service.AnnotationBasedTagProvider@40712ee9, net.thucydides.core.statistics.service.FeatureStoryTagProvider@2e53b094, net.thucydides.core.requirements.FileSystemRequirementsTagProvider@39fa8ad2, net.thucydides.core.requirements.AnnotationBasedTagProvider@76ddd61a]
[INFO] ADDING REQUIREMENTS PROVIDER net.thucydides.core.requirements.FileSystemRequirementsTagProvider@39fa8ad2
[INFO] ADDING REQUIREMENTS PROVIDER net.thucydides.core.requirements.AnnotationBasedTagProvider@76ddd61a
[INFO] Reading requirements from net.thucydides.core.requirements.FileSystemRequirementsTagProvider@39fa8ad2
[INFO] Reading requirements from net.thucydides.core.requirements.AnnotationBasedTagProvider@76ddd61a
[INFO] Requirements found:[]
log4j:WARN No appenders could be found for logger (freemarker.cache).
log4j:WARN Please initialize the log4j system properly.
[INFO] Generating release reports for: []
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.164 s
[INFO] Finished at: 2014-04-25T11:38:33-05:00
[INFO] Final Memory: 16M/120M
[INFO] ------------------------------------------------------------------------

什么都没有发生?测试已设置,它们不是 @Pending 或任何东西,它们只是被完全忽略。这是默认提供的 SearchByKeywordStoryTest.java:

@Story(Application.Search.SearchByKeyword.class)
@RunWith(ThucydidesRunner.class)
public class SearchByKeywordStoryTest {

    @Managed(uniqueSession = true)
    public WebDriver webdriver;

    @ManagedPages(defaultUrl = "http://en.wiktionary.org/wiki/Wiktionary:Main_Page")
    public Pages pages;

    @Steps
    public EndUserSteps endUser;

    @Issue("#WIKI-1")
    @Test
    public void searching_by_keyword_apple_should_display_the_corresponding_article() {
        endUser.is_the_home_page();
        endUser.looks_for("apple");
        endUser.should_see_definition("A common, round fruit produced by the tree Malus domestica, cultivated in temperate climates.");

    }

    @Test
    public void searching_by_keyword_banana_should_display_the_corresponding_article() {
        endUser.is_the_home_page();
        endUser.looks_for("pear");
        endUser.should_see_definition("An edible fruit produced by the pear tree, similar to an apple but elongated towards the stem.");
    }

    @Pending @Test
    public void searching_by_ambiguious_keyword_should_display_the_disambiguation_page() {
    }
} 

我很感激任何帮助。我不知道我错过了什么 - 我是 maven、selenium 和 thucydides 的新手,所以我确定我做错了什么。一旦我让 JUnit 测试真正运行,我就可以开始了……谢谢。

4

2 回答 2

1

找到它 - 在我的 POM 中,我有:

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
        ...
    </plugins>

当我问这个问题时,我没有看到这一点。为什么这会成为原型中的标准?我不知道。

谢谢。

于 2014-04-25T16:13:22.507 回答
0

默认原型将所有内容配置为作为集成测试运行,而不是单元测试(即故障安全而不是万无一失)。

这意味着它们不在 mvn:test 上运行,需要执行 mvn:verify。

看:

http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

于 2014-07-30T17:56:15.627 回答