在classpath中找不到类:在Eclipse + TestNg中运行pom.xml时

时间:2014-05-23 05:05:10

标签: java maven eclipse-plugin maven-2 testng

当尝试运行pom.xml作为Maven Build时,我收到以下错误(m2添加了apache-maven-3.2.1-bin lib)。我正在使用Eclipse Kepler IDE。     如果我手动运行MytestXml文件作为TestNg然后它工作正常。以下错误只有当我尝试运行pom.xml文件时

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project seleniumtests: Execution default-test of goal     org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the 
[ERROR] org.testng.TestNGException:
[ERROR] Cannot find class in classpath: com.proj.website.test.MyProjectXML


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.cap</groupId>
    <artifactId>seleniumtests</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>

    <dependencies>

    <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>2.41.0</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.3.1</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.17</version>
                <configuration>

                    <suiteXmlFiles>
                        <suiteXmlFile>MyTest.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>

        </plugins>
    </build>
</project>

MyTest.xml
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="logon Verfication" verbose="3" parallel="tests">
    <parameter name="appURL" value="http://www.dummysite.com" ></parameter> 

    <test name="Test for Demo And Security">
        <parameter name="browser" value="Chrome"></parameter>

        <classes>
               <class name="com.proj.website.test.MyProjectXML" />
        </classes>

    </test>

0 个答案:

没有答案