简体   繁体   English

Maven没有进行硒测试

[英]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会查找名为*TestTest**TestCaseTest* 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.

相关问题 Maven显示JAR包含错误并且未运行硒接受测试 - Maven show JAR inclusion error and doesn't run selenium acceptance test Maven找不到要运行的JUnit测试 - Maven doesn't find JUnit test to run 硒不运行下一个测试操作吗? - Selenium doesn't run next test operation? Maven 没有运行我的 Appium(selenium) 测试 - Maven doesn't run my Appium(selenium) tests Maven failsafe插件不会运行并行测试 - Maven failsafe plugin doesn't run parallel Test Selenium RC无法通过BAT文件运行测试套件 - Selenium RC doesn't run the test suite by BAT file 使用Selenium RC启动指定的浏览器后,测试无法运行 - After launching the specified browser with Selenium RC, The test doesn't run 如何使用junit和maven运行硒测试 - How to run selenium test using junit and maven 我的测试正在运行,然后我单击“运行为--> Maven clean”,现在当我单击“运行为--> Maven 测试”时,它不再起作用 - My tests were running and then I clicked “Run as --> Maven clean” and now when I click “Run as --> Maven test” it doesn't work anymore Maven项目(Cucumber + TestNG + Selenium-Java)测试无法使用mvn clean install在命令行上运行测试 - Maven Project(Cucumber+TestNG+Selenium-Java] Test Can't Run test on command line with mvn clean install
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM