2015-10-16 37 views
0

前段時間,我在我的集​​成測試,在我的POM文件我有這個使用FitNesse中使用FIT作爲test_system:裝修MAVE-插件相當於薄型

 <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>fit-maven-plugin</artifactId> 
      <version>2.0-beta-3</version> 
      <executions> 
       <execution> 
        <configuration> 
         <sourceDirectory>src/main/fit</sourceDirectory> 
         <sourceIncludes>**/*Test.html</sourceIncludes> 
         <outputDirectory>target/fitTest</outputDirectory> 
        </configuration> 
        <goals> 
         <goal>run</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

現在我想要做同樣的看法,但使用苗條,但我找不到SLIM的任何等效插件。

有誰知道如何用'mvn integration-test'執行一些Slim測試嗎?我看到有這個fitnesse-launcher-maven-plugin,但是我需要啓動一個服務,並且我想要像之前那樣的東西,不需要使用端口和所有東西來獲得服務

回答

1

最簡單的方法是將@Unit測試添加到使用@RunWith(「FitNesseRunner.class」)註釋的項目中,並且在您的pom文件中指出此測試不是單元測試套件的一部分,並且是集成的一部分測試套件。

這實際上適用於Slim和Fit測試。也可以用來輕鬆地調試燈具代碼(只需調試IDE中的單元測試)。

示例Java類:

@RunWith(FitNesseRunner.class) 
@FitNesseRunner.Suite("FitNesse.SuiteAcceptanceTests.SuiteSlimTests.TestScriptTable") 
@FitNesseRunner.FitnesseDir(".") 
@FitNesseRunner.OutputDir("./target/fitnesse-results") 
public class FixtureDebugTest { 
} 

樣品甲醛含量提取物:

  <plugin> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.18.1</version> 
      <configuration> 
       <excludes> 
        <!-- this test actually runs fitnesse tests 
         therefore it will only be executed for 
         integration-test goal 
        --> 
        <exclude>**/FixtureDebugTest.java</exclude> 
       </excludes> 
      </configuration> 
     </plugin> 
     <plugin> 
      <artifactId>maven-failsafe-plugin</artifactId> 
      <version>2.18.1</version> 
      <configuration> 
       <!-- this test actually runs fitnesse tests--> 
       <test>FixtureDebugTest</test> 
      </configuration> 
     </plugin> 

在我自己的FitNesse的項目,我有FitNesseRunner的自定義子類,需要在類較少的註解,並允許「要運行的套件'使用系統屬性來重寫(我在構建服務器上使用它來在不需要多個Java類的情況下在不同的作業中運行不同的套件)。這是部分:https://github.com/fhoeben/hsac-fitnesse-fixtures

+0

我試過這種方法,但每次我執行命令'mvn clean integration-test'結果是**測試運行:0,失敗:0,錯誤:0,跳過:0 **,但如果我打開報告,測試的一行失敗。 – jordiPons

+0

我不知道這是否相關,但我總是使用'mvn clean test-compile failsafe:integration-test'運行。測試是使用你的命令編譯的嗎? –

0

的FitNesse中,發射器 - Maven的插件就可以開始FitNesse的爲你使用它的默認端口是9123,所以你可以在http://localhost:9123/

文檔看測試是簡單的跟隨,你可以有以下配置:

 <plugin> 
     <groupId>uk.co.javahelp.fitnesse</groupId> 
     <artifactId>fitnesse-launcher-maven-plugin</artifactId> 
     <configuration> 
      <failIfNoTests>false</failIfNoTests> 
     </configuration> 
     <executions> 
      <execution> 
      <goals> 
       <goal>set-up</goal> 
       <goal>run-tests</goal> 
       <goal>tear-down</goal> 
       <goal>verify</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin>