テストを実行してレポートを生成するために必要なすべてのライブラリが含まれている実行可能なJARに受け入れテストをパッケージ化したいと思います。また、すべてのテストまたは単一のテストを実行することもできます。実行可能なJARから単一のキュウリのシナリオを実行
これまではすべてのテストを実行できましたが、serenity.propertiesで指定した場所にレポートが生成されていても、index.htmlは生成されていません。
通常、私はserenity-maven-pluginを実行するmaven verify goalを使用してテストを実行しますが、JARから実行しているので、私は同じことをどのように達成できるかはわかりません。
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features = "classpath:com/cfhayes/test/LookupADefinition.feature")
public class DefinitionTestSuite {
public static void main(String[] args) throws Exception {
JUnitCore.main("com.cfhayes.test.DefinitionTestSuite");
}
}
そして、私は単一のシナリオを指定することができるように私の機能ファイルを実行するためにタグを使用しています:
Feature: Lookup a definition
@TEST-0001
Scenario: Looking up the definition of 'apple'
Given the user is on the Wikionary home page
When the user looks up the definition of the word 'apple'
Then they should see the definition 'A common, round fruit produced by the tree Malus domestica, cultivated in temperate climates.'
@TEST-0002
Scenario: Looking up the definition of 'pear'
Given the user is on the Wikionary home page
When the user looks up the definition of the word 'pear'
Then they should see the definition 'An edible fruit produced by the pear tree, similar to an apple but elongated towards the stem.'
を私が望んでいる
は、私は次のように見えるメインクラスを持っています実行可能なJARでJVM引数を使用してキュウリのオプションを設定できるようにする方法です。私は次のようなことを試みました:java -jar my-test-jar.jar -Dcucumber.options="--tags @TEST-0001"
...しかし、それでもすべてのテストが実行されます。
アイデアをいただければ幸いです。
私は今すぐ必要なものです。あなたはどんな解決策も考え出しましたか? – yuva
はい、私が持っていた問題は単純にコマンドライン引数の順序でした。 java -Ducucumber.options = " - tags @ TEST-0001" -jar my-test-jar.jar これ以外の変更は必要ありませんでした。 – cfhayes
ここで実例を見てみましょう。 https://github.com/ch88251/cucumber-serenity-example – cfhayes