2016-08-29 150 views
0

我想測試我的應用程序vaadin測試平臺,但是當我嘗試使用測試上Vaadin與測試平臺

MVN清潔運行我的測試驗證,他不`噸開始我的服務器來執行測試,我使用此示例: https://vaadin.com/docs/-/part/testbench/testBench-tutorial.html這是我的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>br.com.lumera</groupId> 
    <artifactId>integra</artifactId> 
    <packaging>war</packaging> 
    <version>1.0</version> 
    <name>integra</name> 

    <prerequisites> 
     <maven>3</maven> 
    </prerequisites> 

    <properties> 
     <vaadin.version>7.7.0</vaadin.version> 
     <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version> 
     <vaadin.testbench.version>4.1.0.alpha2</vaadin.testbench.version> 
     <jetty.plugin.version>9.3.9.v20160517</jetty.plugin.version> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <maven.compiler.source>1.8</maven.compiler.source> 
     <maven.compiler.target>1.8</maven.compiler.target> 
     <!-- If there are no local customisations, this can also be "fetch" or 
      "cdn" --> 
     <vaadin.widgetset.mode>local</vaadin.widgetset.mode> 
    </properties> 

    <repositories> 
     <repository> 
      <id>vaadin-addons</id> 
      <url>http://maven.vaadin.com/vaadin-addons</url> 
     </repository> 
     <repository> 
      <id>vaadin-snapshots</id> 
      <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url> 
      <releases> 
       <enabled>false</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </repository> 
    </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>vaadin-snapshots</id> 
      <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url> 
      <releases> 
       <enabled>false</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </pluginRepository> 
    </pluginRepositories> 

    <dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>com.vaadin</groupId> 
       <artifactId>vaadin-bom</artifactId> 
       <version>${vaadin.version}</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.6</version> 
       <configuration> 
        <failOnMissingWebXml>false</failOnMissingWebXml> 
        <!-- Exclude an unnecessary file generated by the GWT compiler. --> 
        <packagingExcludes>WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>com.vaadin</groupId> 
       <artifactId>vaadin-maven-plugin</artifactId> 
       <version>${vaadin.plugin.version}</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>update-theme</goal> 
          <goal>update-widgetset</goal> 
          <goal>compile</goal> 
          <!-- Comment out compile-theme goal to use on-the-fly theme compilation --> 
          <goal>compile-theme</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-clean-plugin</artifactId> 
       <version>3.0.0</version> 
       <!-- Clean up also any pre-compiled themes --> 
       <configuration> 
        <filesets> 
         <fileset> 
          <directory>src/main/webapp/VAADIN/themes</directory> 
          <includes> 
           <include>**/styles.css</include> 
           <include>**/styles.scss.cache</include> 
          </includes> 
         </fileset> 
        </filesets> 
       </configuration> 
      </plugin> 

      <!-- The Jetty plugin allows us to easily test the development build by 
       running jetty:run on the command line. --> 
      <plugin> 
       <groupId>org.eclipse.jetty</groupId> 
       <artifactId>jetty-maven-plugin</artifactId> 
       <version>${jetty.plugin.version}</version> 
       <configuration> 
        <scanIntervalSeconds>2</scanIntervalSeconds> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <dependencies> 
     <dependency> 
      <groupId>org.jboss.resteasy</groupId> 
      <artifactId>resteasy-jackson2-provider</artifactId> 
      <version>3.0.19.Final</version> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss.resteasy</groupId> 
      <artifactId>resteasy-client</artifactId> 
      <version>3.0.19.Final</version> 
     </dependency> 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-testbench-api</artifactId> 
      <version>${vaadin.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.vaadin.addons</groupId> 
      <artifactId>ckeditor-wrapper-for-vaadin</artifactId> 
      <version>7.10.9</version> 
     </dependency> 
     <dependency> 
      <groupId>org.vaadin.addon</groupId> 
      <artifactId>easyuploads</artifactId> 
      <version>7.4.6</version> 
     </dependency> 
     <dependency> 
      <groupId>org.vaadin.addons</groupId> 
      <artifactId>vaadin-grid-util</artifactId> 
      <version>1.0.8</version> 
     </dependency> 
     <dependency> 
      <groupId>de.steinwedel.vaadin.addon</groupId> 
      <artifactId>messagebox</artifactId> 
      <version>3.0.17</version> 
     </dependency> 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-testbench</artifactId> 
      <version>4.1.0.alpha2</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.vaadin.addons</groupId> 
      <artifactId>vaadin-combobox-multiselect</artifactId> 
      <version>1.1.11</version> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>javax.servlet-api</artifactId> 
      <version>3.0.1</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-server</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-push</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-client-compiled</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>com.vaadin</groupId> 
      <artifactId>vaadin-themes</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>com.google.guava</groupId> 
      <artifactId>guava</artifactId> 
      <version>19.0</version> 
     </dependency> 
    </dependencies> 



    <profiles> 
     <profile> 
      <!-- Vaadin pre-release repositories --> 
      <id>vaadin-prerelease</id> 
      <activation> 
       <activeByDefault>false</activeByDefault> 
      </activation> 

      <repositories> 
       <repository> 
        <id>vaadin-addons</id> 
        <url>http://maven.vaadin.com/vaadin-addons</url> 
       </repository> 
       <repository> 
        <id>vaadin-prereleases</id> 
        <url>http://maven.vaadin.com/vaadin-prereleases</url> 
       </repository> 
      </repositories> 
      <pluginRepositories> 
       <pluginRepository> 
        <id>vaadin-prereleases</id> 
        <url>http://maven.vaadin.com/vaadin-prereleases</url> 
       </pluginRepository> 
      </pluginRepositories> 
     </profile> 
    </profiles> 

</project> 

但我注意到,當之前的運行測試,我測試通過啓動我的服務器,但運行測試後,他試圖啓動我的服務器

我把原創開始/停止碼頭

<plugin> 
       <groupId>org.eclipse.jetty</groupId> 
       <artifactId>jetty-maven-plugin</artifactId> 
       <version>${jetty.plugin.version}</version> 
       <configuration> 
        <scanIntervalSeconds>2</scanIntervalSeconds> 
       </configuration> 
      </plugin> 

但是不工作。

回答

0

我沒有在鏈接文檔的「自動啓動服務器」部分中看到任何Jetty配置。與集成前測試/集成後測試階段相關的啓動和停止目標將負責在集成測試運行之前啓動服務器並在之後停止。

最後,您需要確保您的測試運行在集成測試階段,而不是在單元測試階段。如果它們在單元測試階段運行,則預集成測試階段尚未執行且服務器尚未啓動。將您的測試命名爲SomethingIT.java(而不是SomethingTest.java)以確保它在集成測試階段運行。

+0

我更新了問題,我把原始開始/停止碼頭,我試圖與mvn運行乾淨驗證(只是網站說)如果我運行mvn碼頭:運行服務器正常啓動 –

+0

我仍然無法看到在您的pom.xml中預集成測試/後集成測試部分,所以服務器不會自動啓動 –