Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Eclipse 仅当我使用Maven(test)运行测试用例时,TestNG测试结果控制台才为空_Eclipse_Maven_Selenium_Testng_Pom.xml - Fatal编程技术网

Eclipse 仅当我使用Maven(test)运行测试用例时,TestNG测试结果控制台才为空

Eclipse 仅当我使用Maven(test)运行测试用例时,TestNG测试结果控制台才为空,eclipse,maven,selenium,testng,pom.xml,Eclipse,Maven,Selenium,Testng,Pom.xml,我已经为我的自动化selenium脚本创建了一个maven项目,并将所有必需的依赖项添加到pom.xml中。 如果我进行maven构建(测试),TestNG.xml中提到的测试用例运行良好。但TestNG测试结果控制台为空。它没有说关于有多少案件被执行和通过的任何信息?尽管Eclipse控制台输出具有测试状态 TestNG.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://tes

我已经为我的自动化selenium脚本创建了一个maven项目,并将所有必需的依赖项添加到pom.xml中。 如果我进行maven构建(测试),TestNG.xml中提到的测试用例运行良好。但TestNG测试结果控制台为空。它没有说关于有多少案件被执行和通过的任何信息?尽管Eclipse控制台输出具有测试状态

TestNG.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite guice-stage="DEVELOPMENT" name="Default suite" >
  <test verbose="2" name="Default test" >
    <classes >
      <class name="automation.BrowserNavigation"/>
    </classes>
  </test> <!-- Default test -->
</suite> <!-- Default suite -->
POM.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>TupasRegression</groupId>
  <artifactId>TupasRegression</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>src</directory>

      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>

      <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
        <suiteXmlFiles>
            <suiteXmlFile>src/TestNG.xml</suiteXmlFile>
        </suiteXmlFiles>
    </configuration>
</plugin>
    </plugins>

  </build>

  <profiles>

</profiles>
<dependencies>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>2.53.0</version>
</dependency>
  <dependency>
              <groupId>org.apache.poi</groupId>
              <artifactId>poi</artifactId>
              <version>3.14</version>
              <scope>compile</scope>
           </dependency>
           <dependency>
              <groupId>org.apache.poi</groupId>
              <artifactId>poi-examples</artifactId>
              <version>3.14</version>
              <scope>compile</scope>
           </dependency>
               <dependency>
              <groupId>org.apache.poi</groupId>
              <artifactId>poi-excelant</artifactId>
              <version>3.14</version>
              <scope>compile</scope>
           </dependency>



          <dependency>
                 <groupId>org.apache.poi</groupId>
                 <artifactId>poi-ooxml</artifactId>
                 <version>3.14</version>
                 <scope>compile</scope>
          </dependency>
          <dependency>
                 <groupId>org.apache.poi</groupId>
                 <artifactId>poi-ooxml-schemas</artifactId>
                 <version>3.14</version>
                 <scope>compile</scope>
          </dependency>
          <dependency>
                 <groupId>org.apache.poi</groupId>
                 <artifactId>poi-scratchpad</artifactId>
                 <version>3.14</version>
                 <scope>compile</scope>
          </dependency>




<!-- </dependency> -->


          <dependency>
                 <groupId>org.apache.poi</groupId>
                 <artifactId>openxml4j</artifactId>
                 <version>1.0-beta</version>
          </dependency>

     <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.3.1</version>
        </dependency>


</dependencies>
</project>
TestNG.xml:
POM.xml:
4.0.0
图帕斯回归

我也有同样的问题。我认为我的答案不是解决问题的方法,但通过在浏览器上运行index.html,您可以看到有多少案例被执行,有多少案例被传递到index.html中,该文件位于测试输出文件夹中。每次运行testcases时,TestNG都会更新此文件。

我也遇到了同样的问题。我认为我的答案不是解决问题的方法,但通过在浏览器上运行index.html,您可以看到有多少案例被执行,有多少案例被传递到index.html中,该文件位于测试输出文件夹中。每次运行testcases时,TestNG都会更新此文件。

在屏幕截图中显示的TestNG控制台不会显示任何结果-这是一个TestNG插件提供的控制台,只有当您选择以运行方式->TestNG(套件/测试)选项运行测试或套件时,它才会显示结果


当您运行maven时,testng插件不会被执行,因此您在控制台中看不到任何内容。如果需要此运行的结果,则需要检查maven生成的目标文件夹中的test results文件夹。

屏幕截图中显示的testng控制台不会显示任何结果-这是testng插件提供的控制台,仅当您选择以->testng的方式运行测试或套件时才会显示结果(套件/测试)选项


当您运行maven时,testng插件不会被执行,因此您在控制台中看不到任何内容。如果您需要此运行的结果,您需要检查maven生成的目标文件夹中的test results文件夹。

可以在maven构建控制台输出中显示测试结果

1) 创建一个testng.xml文件,该文件概述了您的测试类

在eclipse中,右键单击maven项目,然后选择TESTNG>Convert To TESTNG

2) 更新Maven POM文件以包含相关的依赖项和插件。 关键配置是Maven surefire插件,该插件被配置为指向testng.xml文件

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.45.0</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <!-- Following plugin executes the testng tests -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.14.1</version>
            <configuration>
                <!-- Suite testng xml file to consider for test execution -->
                <suiteXmlFiles>
                    <suiteXmlFile>testng.xml</suiteXmlFile>

                </suiteXmlFiles>
            </configuration>
        </plugin>
        <!-- Compiler plugin configures the java version to be usedfor compiling 
            the code -->
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
        </plugin>
    </plugins>
</build>

朱尼特
朱尼特
3.8.1
测试
org.seleniumhq.selenium
硒爪哇
2.45.0
org.testng
testng
6.8
测试
org.apache.maven.plugins
maven surefire插件
2.14.1
testng.xml
maven编译器插件


3) 运行Maven测试,TestNG结果将显示在Maven输出控制台中。

可以在Maven构建控制台输出中显示测试结果

1) 创建一个testng.xml文件,该文件概述了您的测试类

在eclipse中,右键单击maven项目,然后选择TESTNG>Convert To TESTNG

2) 更新Maven POM文件以包含相关的依赖项和插件。 关键配置是Maven surefire插件,该插件被配置为指向testng.xml文件

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.45.0</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <!-- Following plugin executes the testng tests -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.14.1</version>
            <configuration>
                <!-- Suite testng xml file to consider for test execution -->
                <suiteXmlFiles>
                    <suiteXmlFile>testng.xml</suiteXmlFile>

                </suiteXmlFiles>
            </configuration>
        </plugin>
        <!-- Compiler plugin configures the java version to be usedfor compiling 
            the code -->
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
        </plugin>
    </plugins>
</build>

朱尼特
朱尼特
3.8.1
测试
org.seleniumhq.selenium
硒爪哇
2.45.0
org.testng
testng
6.8
测试
org.apache.maven.plugins
maven surefire插件
2.14.1
testng.xml
maven编译器插件


3) 运行Maven测试,TestNG结果将出现在Maven输出控制台中。

如果我错了,请纠正我,但是Maven surefire插件应该生成一个包含JUnit结果的xml文件,即使您使用TestNG。您可以双击Eclipse中的xml文件。如果我错了,请纠正我,但是maven surefire插件应该生成一个包含JUnit结果的xml文件,即使您使用TestNG。您可以在Eclipse中双击xml文件。这不会回答问题,如果您决定发布,则应为注释。这不会回答问题,如果您决定发布,则应为注释。