[英]Maven doesn't run selenium test
Hello I'm trying to run a JUnit test using Maven. 您好我正在尝试使用Maven运行JUnit测试。
public final class CreateAllObject {
public static final String INIT_URL = new String("http://fpt2:8080/webTest/");
@BeforeClass
public static void initialisation()
{
Driver driver = new Driver(PROFILE_PATH);
driver.getDriver().get(INIT_URL);
driver.getDriver().findElement(By.xpath(ADMIN_ARM_XPATH)).click();
BASE_URL = driver.getDriver().getCurrentUrl();
driver.getDriver().close();
try {
new File("C://logfiles//").mkdirs();
log_work = new BufferedWriter (new FileWriter(
new File("C://logfiles//" +
new SimpleDateFormat("dd.MM.yyyy 'at' HH-mm-ss").format(
new GregorianCalendar().getTime())+".log_work")));
} catch (IOException e) {
e.printStackTrace();
}
}
@Test
public void test()
{
Driver driver = new Driver( PROFILE_PATH );
...
}
@AfterClass
public static void destruction()
{
try
{
log_work.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
} }
After running command mvn test
in the project's base directory I'm getting this : 在项目的基目录中运行命令
mvn test
之后我得到了这个:
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ uitests-core ---
[INFO] --- maven-compiler-plugin:2.3.2:testCompile(default-testCompile)@ uitests-core ---
[INFO] Nothing to compile - all classes are up to date
[INFO]无需编译 - 所有课程都是最新的
[INFO]
[信息]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ uitests-core ---
[INFO] --- maven-surefire-plugin:2.10:test(default-test)@ uitests-core ---
[INFO] Surefire report directory: /var/opt/jenkins/workspace/platform-ui-tests/core/target/surefire-reports
[INFO] Surefire报告目录:/ var / opt / jenkins / workspace / platform-ui-tests / core / target / surefire-reports
------------------------------------------------------- TESTS
-------------------------------------------------- -----测试
Results :
结果:
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
测试运行:0,失败:0,错误:0,跳过:0
I don't know why it doesn't run my test. 我不知道为什么它没有运行我的测试。 Help me please.
请帮帮我。
Maven looks for tests named *Test
, Test*
, or *TestCase
by default. 默认情况下,Maven会查找名为
*Test
, Test*
或*TestCase
的Test*
。 You can configure it to run classes with other names, but it's much better to follow the conventions if you don't have a compelling reason not to. 您可以将其配置为运行具有其他名称的类,但如果您没有令人信服的理由,则遵循这些约定要好得多。 Rename your class to something that starts or ends in
Test
and give it another try. 将您的类重命名为在
Test
中开始或结束的内容并再次尝试。
See this answer: Maven does not find JUnit tests to run as well. 看到这个答案: Maven没有发现JUnit测试也能运行 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.