2016-10-06 13 views
0

私はscalatest-maven-plugin最新バージョン1.0を使用しています。source code hereです。並行して、私のスイートを実行しようとすると、次の設定を使用して:Scalatest mavenプラグイン:エラー:-cは非常に長い間廃止され、サポートされなくなりました

<build><plugin> 
    <groupId>org.scalatest</groupId> 
    <artifactId>scalatest-maven-plugin</artifactId> 
    <version>1.0</version> 
    <configuration> 
     <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory> 
     <junitxml>.</junitxml> 
     <filereports>WDF TestSuite.txt</filereports> 
     <htmlreporters>${project.build.directory}/html/scalatest</htmlreporters>      
     <parallel>true</parallel> 
    </configuration> 
    <executions> 
     <execution> 
      <id>test</id> 
      <goals> 
       <goal>test</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin></build> 

はエラーを構築し、次のMavenにつながる:

[INFO] 
[INFO] --- scalatest-maven-plugin:1.0:test (test) @ myproject --- 
Exception in thread "ScalaTest-main" java.lang.IllegalArgumentException: ERROR: -c has been deprecated for a very long time and is no longer supported, to prepare for reusing it for a different purpos 
e in the near future. Please change all uses of -c to -P. 
     at org.scalatest.tools.ArgsParser$.checkArgsForValidity(ArgsParser.scala:46) 
     at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:857) 
     at org.scalatest.tools.Runner$.main(Runner.scala:827) 
     at org.scalatest.tools.Runner.main(Runner.scala) 

基本的にscalatest-のmaven-pluginのではなく、scalatest CLIに-cを渡していますより正確な、すなわち使用するスレッドの数。

-P10をMaven経由でスカラーテストプロセスに渡すにはどうすればよいですか?私はMAVEN_OPTS環境変数またはMaven CLIに直接設定しようとしましたが、取得されませんでした。

私はまた、このようなscalatest-のmaven-pluginの設定を試してみました:

<configuration> 
    <argLine>-P10</argLine> 
</configuration> 

が、それはあまりにも失敗したので、このパラメータはJavaプロセスにしていないScalatestに渡されます。

答えて

1

私はmy own fork of the scalatest-maven-pluginを作成し、並列の問題を修正し、1.1-SNAPSHOTとしてバージョンを修正しました。ビルドなどを修正する必要がありました。私は、その後scalatest-maven-plugin_1.1-SNAPSHOT.tar.gz

はそれをテストするために直接コンパイルダウンロードtarファイルのバージョンが含まれmy own fork of the scalatest-maven-pluginを使用my own version of a scala-maven-exampleをフォークし、各スイートの最初のテストを実行し、各スイートとスレッドIDをロードするスレッドIDを表示するscalatestサンプルコードを改変しました。私はまた、現在のスレッドをそれぞれのポイントでランダムに10秒間スリープさせて、何が起こっているのかを確認します。パラレルが有効になっている場合、すべてのスカラートスイートは単一のスレッドによってロードされ、並列に実行されます。

これは<parallel>false</parallel>を使用した結果である:

[INFO] --- scalatest-maven-plugin:1.1-SNAPSHOT:test (test) @ scala-maven-testing --- 
Discovery starting. 
** loading 'net.lockney.AcceptanceTest' Suite with ThreadId=1 
==> executing 'Simple thing state' test with ThreadId=1 
** loading 'net.lockney.MatcherExampleSuite' Suite with ThreadId=1 
** loading 'net.lockney.SimpleSpec' Suite with ThreadId=1 
** loading 'net.lockney.SimpleSuite' Suite with ThreadId=1 
Discovery completed in 19 seconds, 98 milliseconds. 
Run starting. Expected test count is: 8 
AcceptanceTest: 
As a user 
I want to be able to create a simple thing and implicitly start it 
So that I can then turn it off 
And see that it is stopped 
Feature: Simple thing state 
    Scenario: User stops thing when it's already on 
    Given An initialized thing, that has not been started 
    When User stops it again 
    Then We should see that it is stopped 
==> executing 'equality' test with ThreadId=1 
MatcherExampleSuite: 
- equality 
==> executing 'SimpleObject' should 'accept a String' test with ThreadId=1 
- string matchers *** FAILED *** 
    "something" did not end with substring "some" (MatcherExampleSuite.scala:29) 
SimpleSpec: 
SimpleObject 
- should accept a String 
- should even accept really long Strings 
==> executing 'An empty Set should have size 0' test with ThreadId=1 
... 
Run completed in 28 seconds, 300 milliseconds. 
Total number of tests run: 8 
Suites: completed 5, aborted 0 
Tests: succeeded 6, failed 2, canceled 0, ignored 0, pending 0 
*** 2 TESTS FAILED *** 

、これは<parallel>true</parallel><parallelThreads>10</parallelThreads>を用いた結果である:

[INFO] --- scalatest-maven-plugin:1.1-SNAPSHOT:test (test) @ scala-maven-testing --- 
Discovery starting. 
** loading 'net.lockney.AcceptanceTest' Suite with ThreadId=1 
==> executing 'Simple thing state' test with ThreadId=1 
** loading 'net.lockney.MatcherExampleSuite' Suite with ThreadId=1 
** loading 'net.lockney.SimpleSpec' Suite with ThreadId=1 
** loading 'net.lockney.SimpleSuite' Suite with ThreadId=1 
Discovery completed in 30 seconds, 904 milliseconds. 
Run starting. Expected test count is: 8 
MatcherExampleSuite: 
SimpleSuite: 
AcceptanceTest: 
SimpleSpec: 
SimpleObject 
As a user 
I want to be able to create a simple thing and implicitly start it 
So that I can then turn it off 
And see that it is stopped 
Feature: Simple thing state 
==> executing 'An empty Set should have size 0' test with ThreadId=13 
==> executing 'SimpleObject' should 'accept a String' test with ThreadId=12 
==> executing 'equality' test with ThreadId=11 
... 
Run completed in 40 seconds, 706 milliseconds. 
Total number of tests run: 8 
Suites: completed 5, aborted 0 
Tests: succeeded 6, failed 2, canceled 0, ignored 0, pending 0 
*** 2 TESTS FAILED *** 
関連する問題