2014-02-04 3 views
0

У меня есть набор тестов на селен, разделенных на классы java. У меня есть сценарий драйвера, в котором я создаю программный пакет testng xml и запускаю его. Все работает отлично, когда вызывается из затмения или муравья. Я хотел заменить муравья maven и запустить тесты. Но получить это исключение.Исключение TestNG при работе с Maven

[TestRunner] Running the tests in 'TestClass10' with parallel mode:false 
[RunInfo] Adding method selector: [email protected] priority: 10 
ERROR::org.testng.TestNGException: 
Cannot instantiate class com.prt.regressionsuite.test10.TestClass10 
===== Invoked methods 
TestDriver.runTestSuite()[pri:0, instance:[email protected]] 1551083435 

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/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.prt</groupId> 
    <artifactId>B_Selenium_RC</artifactId> 
    <packaging>jar</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>B_Selenium_RC</name> 
    <url>http://maven.apache.org</url> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>exec-maven-plugin</artifactId> 
       <version>1.2.1</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>java</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <mainClass>com.prt.driver.TestDriver</mainClass> 
        <systemProperties> 
         <systemProperty> 
          <timestamp>${timestamp}</timestamp> 
         </systemProperty> 
         <systemProperty> 
          <datestamp>${datestamp}</datestamp> 
         </systemProperty> 
        </systemProperties> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <dependencies> 
     <dependency> 
      <groupId>net.sourceforge.jexcelapi</groupId> 
      <artifactId>jxl</artifactId> 
      <version>2.6.12</version> 
     </dependency> 
     <dependency> 
      <groupId>com.oracle</groupId> 
      <artifactId>ojdbc14</artifactId> 
      <version>10.2.0.2.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.testng</groupId> 
      <artifactId>testng</artifactId> 
      <version>6.8</version> 
     </dependency> 
     <dependency> 
      <groupId>org.seleniumhq.selenium.server</groupId> 
      <artifactId>selenium-server</artifactId> 
      <version>1.0.3-standalone</version> 
     </dependency> 
    </dependencies> 
</project> 

Searched интернет-форумах, но не мог получить решение этой проблемы. Пожалуйста, помогите по этому поводу.

+0

Почему вы пытаетесь запустить интеграционные тесты с помощью exec-maven-plugin вместо maven-failafe-plugin? – khmarbaise

+0

TestDriver - это основной класс в моем пакете. Большинство форумов, которые я искал, предложили плагин exec, чтобы запустить его. – Akbar

ответ

0

При тестировании с помощью testng xml и surefire plug in, он показал фактическую ошибку в отношении отсутствующего файла данных. Исправлено исключение после включения файла.

Должен сказать, что сообщение об исключении testng не очень полезно при использовании опции «create testng programatically».

Смежные вопросы