重複の可能性:
ClassNotFoundException-テスト目的
別のモジュールに存在するtestngを使用して、他のMavenモジュールに属するクラスを実行することは可能ですか?つまり、モジュールA内にモジュールAとBがある場合、testng.xmlを使用してモジュール2を実行します。お知らせください。可能であれば。ありがとう
多分testngは許可されていないと思います...
重複の可能性:
ClassNotFoundException-テスト目的
別のモジュールに存在するtestngを使用して、他のMavenモジュールに属するクラスを実行することは可能ですか?つまり、モジュールA内にモジュールAとBがある場合、testng.xmlを使用してモジュール2を実行します。お知らせください。可能であれば。ありがとう
多分testngは許可されていないと思います...
私があなたの問題の本質を理解している限り、あなたはmavensurefireプラグインの方向に調査する必要があります。これは、 MavenおよびJUnitカテゴリを使用したユニットテストと統合テストに関するメモ
です。現在のプロジェクトの時点から、次のように使用しました。
rms-web pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.12</version>
</dependency>
</dependencies>
<configuration>
<!--<includes>-->
<!--<include>**/*.class</include>-->
<!--</includes>-->
<excludedGroups>com.exadel.rms.selenium.SeleniumTests</excludedGroups>
</configuration>
</plugin>
PassTest.java
package com.exadel.rms.selenium;
import org.junit.Test;
import java.io.IOException;
import static org.junit.Assert.assertTrue;
/**
* Created with IntelliJ IDEA.
* User: ypolshchykau
* Date: 8/28/12
* Time: 8:38 PM
* To change this template use File | Settings | File Templates.
*/
public class PassTest {
@Test
public void pass() throws IOException, InterruptedException {
assertTrue(true);
}
}
SeleniumTests.java
package com.exadel.rms.selenium;
/**
* Created with IntelliJ IDEA.
* User: ypolshchykau
* Date: 8/27/12
* Time: 6:49 PM
* To change this template use File | Settings | File Templates.
*/
public class SeleniumTests {
}
LoginPageTestSuite.java
package com.exadel.rms.selenium;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;
import java.io.IOException;
@Category(SeleniumTests.class)
public class LoginPageTestSuite extends BaseSeleniumTest {
@Test
public void pressLoginButton() throws IOException, InterruptedException {
doLogout();
fluentWait(By.cssSelector(propertyKeysLoader("login.loginbutton"))).click();
Assert.assertTrue(fluentWait(By.cssSelector(propertyKeysLoader("login.validator.invalidautentication"))).getText().trim().equals("Invalid authentication"));
}
…..........
}
上記のすべての手順の後、コンソールを実行し、次のmavenコマンドを実行します。
mvn -Dmaven.buildNumber.docheck=false -Dmaven.buildNumber.doUpdate=false clean test
タグ付けされたすべてのカテゴリが正常に機能することを確認します。
これがどういうわけかあなたを助けることを願っています。