2017-09-21 5 views
1

生成されたレポートの出力ディレクトリをカスタムディレクトリ(特に.json-Reportファイル)に変更する方法はありますか?jGiven出力ディレクトリ

ドキュメント(http://jgiven.org/userguide/から4.2)言う:

[...] JGivenはそれはMavenの確実なプラグインによって実行されたときに自動検出しようとすると、[私はそれを使用しています]と、その場合には、レポートを生成し、ターゲット/ jgiven-reports/jsonに追加します。 [...]

私はMaven(Appium Tests用)でjGivenを使用しています。

設定(のpom.xml - 依存関係):

<dependency> 
     <groupId>com.tngtech.jgiven</groupId> 
     <artifactId>jgiven-testng</artifactId> 
     <version>0.15.1</version> 
     <scope>test</scope> 
</dependency> 

設定(のpom.xml - ビルド/プラグイン):

<plugin> 
     <groupId>com.tngtech.jgiven</groupId> 
     <artifactId>jgiven-maven-plugin</artifactId> 
     <version>0.15.1</version> 
     <executions> 
      <execution> 
       <goals> 
        <goal>report</goal> 
       </goals> 
      </execution> 
     </executions> 
</plugin> 

ディレクトリはそれが助けにはならないjGivenによって定義されているのでbuild-directoryを変更します。それでも、target/jgiven-reports/jsonディレクトリを使用します。

ありがとうございます!

答えて

1

他の誰かが好奇心旺盛である場合:

私が見つかりました:https://github.com/TNG/JGiven/blob/fae0f3c8db0b00e7fa233cbd8f86306379def4b2/jgiven-core/src/main/java/com/tngtech/jgiven/impl/Config.java#L31String reportDirName = System.getProperty(JGIVEN_REPORT_DIR);(現在のマスター)。

それの重要な部分:

private static final String TRUE = "true"; 
private static final String FALSE = "false"; 
private static final String AUTO = "auto"; 
private static final String JGIVEN_REPORT_ENABLED = "jgiven.report.enabled"; 
public static final String JGIVEN_REPORT_DIR = "jgiven.report.dir"; 
private static final String JGIVEN_REPORT_TEXT = "jgiven.report.text"; 
private static final String JGIVEN_REPORT_TEXT_COLOR = "jgiven.report.text.color"; 
private static final String JGIVEN_FILTER_STACK_TRACE = "jgiven.report.filterStackTrace"; 

ですからのpom.xmlでのmaven-確実な-プラグインを介して、あなたのシステムプロパティを設定することができ、次のいずれか

<plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.5</version> 
      <configuration> 
       <systemPropertyVariables> 
        <jgiven.report.dir>/my/custom/dir</jgiven.report.dir> 
       </systemPropertyVariables> 
      </configuration> 
</plugin> 

か、単にJavaのSystem.setProperty("jgiven.report.dir", "/my/custom/dir")

を使用
関連する問題