2016-03-11 4 views
0

Я пытаюсь запустить методы тестирования, имеющиеся только в testng.xml. Maven goal-Интеграция Maven testng - тесты вне testng.xml выполняются во время фазы тестирования maven

test -Ptest1 -DargLine="-Dbrowser=firefox" -Dmaven.test.failure.ignore=true 

Когда я пытаюсь выполнить выше цели, тесты, присутствующие вне testng.xml становятся выполняться, а также. (Тесты, присутствующие в классах, начиная/кончая * Test)

<profile> 
     <id>test1</id> 
     <build> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-antrun-plugin</artifactId> 
        <version>1.1</version> 
        <executions> 
         <execution> 
          <phase>compile</phase> 
          <goals> 
           <goal>run</goal> 
          </goals> 
          <configuration> 
           <tasks> 
            <echo>Using env.test1.properties</echo> 
            <copy file="src/test/resources/env.test1.properties" 
             tofile="src/test/resources/env.properties" overwrite="true" /> 
           </tasks> 
          </configuration> 
         </execution> 
        </executions> 
       </plugin> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-surefire-report-plugin</artifactId> 
        <version>2.19.1</version> 
        <configuration> 
         <suiteXmlFiles> 
          <file>src/test/resources/testng.xml</file> 
         </suiteXmlFiles> 
         <systemPropertyVariables> 
          <propertyName>browser</propertyName> 
          <buildDirectory>${project.build.directory}</buildDirectory> 
         </systemPropertyVariables> 

        </configuration> 
        <!-- <executions> 
         <execution> 
          <phase>compile</phase> 
          <goals> 
           <goal>java</goal> 
          </goals> 
         </execution> 
        </executions> --> 
       </plugin> 
      </plugins> 
     </build> 
    </profile> 

Моего файл testng.xml выглядит следующим образом

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> 
<suite name="Maven tutorial" verbose="3" > 
<test name="Testie"> 
    <!-- <parameter name="browser" value="firefox"></parameter> --> 
    <classes> 
     <class name="com.maven.tutorial.hello2Test"></class> 

    </classes> 
</test> 

<test name="Testff"> 
    <!-- <parameter name="browser" value="firefox"></parameter> --> 
    <classes> 

     <class name="com.maven.tutorial.hello4Test"></class> 
    </classes> 
</test> 
</suite> 

Когда я запустить Maven цель, она выполняет тесты, присутствующие в классах hello2Test, hello4Test наряду с другим Классом s заканчивается тестом.

ответ

0

изменение

<suiteXmlFiles> 
    <file>src/test/resources/testng.xml</file> 
</suiteXmlFiles> 

в

<suiteXmlFiles> 
    <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile> 
</suiteXmlFiles> 
+0

изменения в не работает ни –

0

я должен был изменить свой плагин от

<artifactId>maven-surefire-report-plugin</artifactId> 

в

<artifactId>maven-surefire-plugin</artifactId> 
Смежные вопросы