无法使用TestNG + Maven套件

时间:2016-03-02 06:03:43

标签: java maven selenium testng allure

设定:

  • Eclipse IDE
  • Mac OS(El Capitan)/ Windows 8.1
  • 项目类型 - Java + TestNG但转换为Maven
  • Selenium,TestNG,Allure-TestNG适配器,AspectJ等的Maven依赖项已添加到POM文件中

项目文件夹结构:

MyProject_V1     --src     --src>配置     --src>卷筒纸     --src>网络> SampleTest_testng.java MyProject_V1图片:my project file structure

+++++++++++++++++++++++++++++++++++++

SampleTest.java:

@Title("Customer Service Header Test")
public class SampleTest_testng {
static WebDriver wd;
static ReusableMethods global_method = new ReusableMethods();

@Stories("Customer Service")
@BeforeClass
public void openBrowser() {
    wd = new FirefoxDriver();
}

@Test
public void getUrl() {
    wd.get("http://www.mudah.my/support.htm?ca=9_s");
    wd.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

@Step("Find the total number of H4 elements")
private void findElementH4() {
    int total_css = wd.findElements(By.cssSelector("h4")).size();
    System.out.println(total_css + "\n");
}

@Step("Get the text for the first H4 element")
private void findFirstH4Element() {
            System.out.println(wd.findElements(By.cssSelector("h4")).get(0).getText());
}

@Step("Get the text for the second H4 element")
private void findSecondH4Element() {
    System.out.println(wd.findElements(By.cssSelector("h4")).get(1).getText());
}

@Step("Get the text for the third H4 element")
private void findThirdH4Element() {
    System.out.println(wd.findElements(By.cssSelector("h4")).get(3).getText());
}

@AfterClass
public void closeBrowser(){
    wd.close();
}

}

的问题:

  1. 当我去终端运行测试时:mvn clean test site,测试只会运行@Test
  2. 说明:

    • 如果我不遵循这个结构并且在@Tests的大块中进行所有测试,那么运行mvn:allure-report会给出我已经成功运行的测试的细分。
    • 在Windows机器上,如果检测到任何针对诱惑的导入,我将无法钻取任何诱惑报告段,如xUnit,Behaviors或Graphs
    • 我只能在Firefox上打开index.html而不能在Google Chrome上打开
    • 我在mvn网站上收到错误:

      Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project SeleniumAutomationSuite_V3: failed to get report for ru.yandex.qatools.allure:allure-maven-plugin: Plugin ru.yandex.qatools.allure:allure-maven-plugin:1.4.22 or one of its dependencies could not be resolved: Failure to find ru.yandex.qatools.allure:allure-maven-plugin:jar:1.4.22 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

    有谁知道可能是什么问题?这是我的项目结构吗?我是Maven的新手,我正在尝试使用它来管理我的依赖项。我试着四处寻找有关错误的更多信息,希望它可以解释为什么诱惑根本没有运行。

    谢谢!

0 个答案:

没有答案