2013-07-02 1 views
0

pom.xml을 통해 testng.xml 파일을 실행하려고하지만 제공하고 있습니다. 그러나 testng.xml은 testng suite로 실행하면 정상적으로 작동합니다. 내가 얻는 오류는 다음과 같다. (콘솔 전체를 붙이기 위해 유감스럽게 생각하지만 기회를 얻고 싶지 않았다.) 내가 받는다는 종속성에서 SLF4J-NOP-1.7.5.jar를 확장하면maven을 통해 testng.xml을 실행하면 오류가 발생합니다.

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
SLF4J: Defaulting to no-operation (NOP) logger implementation 
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building myproj 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[WARNING] The POM for org.seleniumhq.selenium:selenium-server-standalone:jar:2.33.0 is missing, no dependency information available 
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ myproj --- 
[debug] execute contextualize 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 0 resource 
[INFO] 
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ myproj --- 
[INFO] Nothing to compile - all classes are up to date 
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ myproj --- 
[debug] execute contextualize 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 0 resource 
[INFO] 
[INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ myproj --- 
[INFO] Nothing to compile - all classes are up to date 
[INFO] 
[INFO] --- maven-surefire-plugin:2.4.2:test (default-test) @ myproj --- 
[INFO] Surefire report directory: D:\workspace\myproj\target\surefire-reports 

------------------------------------------------------- 
T E S T S 
------------------------------------------------------- 
Running TestSuite 
org.apache.maven.surefire.booter.SurefireExecutionException: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 17; Open quote is expected for attribute "{1}" associated with an element type "name".; nested exception is org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 17; Open quote is expected for attribute "{1}" associated with an element type "name". 
org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 17; Open quote is expected for attribute "{1}" associated with an element type "name". 
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:341) 
    at org.testng.TestNG.run(TestNG.java:1030) 
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74) 
    at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92) 
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338) 
    at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997) 
Caused by: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 17; Open quote is expected for attribute "{1}" associated with an element type "name". 
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) 
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) 
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) 
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) 
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) 
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) 
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) 
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source) 
    at javax.xml.parsers.SAXParser.parse(Unknown Source) 
    at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17) 
    at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10) 
    at org.testng.xml.Parser.parse(Parser.java:172) 
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:311) 
    ... 10 more 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 14.826s 
[INFO] Finished at: Wed Jul 03 20:15:45 IST 2013 
[INFO] Final Memory: 8M/107M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.4.2:test (default-test) on project myproj: There are test failures. 
[ERROR] 
[ERROR] Please refer to D:\workspace\myproj\target\surefire-reports for the individual test results. 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 


나는이 클래스가 있음을 관찰하지만이과의 pom.xml에서 제대로 언급하면 ​​이해가 안 돼요 왜로드에 실패했는지보다. 제가 누락 된 부분을 알려주십시오.

의 pom.xml입니다 : 내가 바로 클릭하고 (w/목표를 지정 O) 메이븐 테스트로 실행하고 메이븐 빌드 시도했지만이 같은 오류를주는 유지 운이 없어

<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>com.myproj.tests</groupId> 
    <artifactId>myproj</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>myproj</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 

    <dependencies> 


     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-server-standalone</artifactId> 
      <version>2.33.0</version> 
     </dependency> 

     <dependency> 
      <groupId>net.sourceforge.jexcelapi</groupId> 
      <artifactId>jxl</artifactId> 
      <version>2.6.12</version> 
     </dependency> 

     <dependency> 
      <groupId>org.testng</groupId> 
      <artifactId>testng</artifactId> 
      <version>6.9.0</version> 
      <scope>test</scope> 
     </dependency> 

     <dependency> 

      <groupId>org.slf4j</groupId> 

      <artifactId>slf4j-nop</artifactId> 

      <version>1.7.5</version> 

     </dependency> 



    </dependencies> 




    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.0</version> 
       <configuration> 
        <source>1.5</source> 
        <target>1.5</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.4.2</version> 
       <configuration> 
        <suiteXmlFiles> 
         <suiteXmlFile>testng.xml</suiteXmlFile> 
        </suiteXmlFiles> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <reporting> 
     <plugins> 
      <!-- TestNG-xslt related configuration. --> 
      <plugin> 
       <groupId>org.testng.xslt</groupId> 
       <artifactId>testng-xslt-plugin</artifactId> 
       <version>1.1</version> 
       <configuration> 
        <!-- Output directory for the report --> 
        <outputDir>${project.basedir}/target/testng-xslt-report</outputDir> 
        <sortTestCaseLinks>true</sortTestCaseLinks> 
        <testDetailsFilter>FAIL,SKIP,PASS,CONF,BY_CLASS</testDetailsFilter> 
        <showRuntimeTotals>true</showRuntimeTotals> 
       </configuration> 
      </plugin> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.5</version> 
       <configuration> 
        <suiteXmlFiles> 
         <suiteXmlFile>testng.xml</suiteXmlFile> 
        </suiteXmlFiles> 
       </configuration> 
      </plugin> 
     </plugins> 
    </reporting> 

    <pluginRepositories> 
     <pluginRepository> 
      <id>testng-xslt-plugin</id> 
      <url>http://www.cosminaru.ro/maven/</url> 
     </pluginRepository> 
    </pluginRepositories> 

</project> 
+0

나는 단지 경고 일 뿐이라고 생각한다. 프로젝트 라인을 스캔 한 후 어떻게 될까? –

+0

@niharika_neo가 내가 가지고있는 오류를 편집했습니다. 그것은 내가 자원 디렉토리를 가지고 있지 않다고 말했기 때문에, 나는 하나 (빈)를 만들었다. – paul

답변

1

오류는 testng의 6.9 버전을 사용할 수 없기 때문에 종속성을 가져올 수 없다는 것입니다. 나는 마지막 릴리즈가 6.8.5라고 생각한다. testng 종속성 버전을 6.8.5로 변경하고 시도하십시오.

+0

testng 버전을 6.8.5로 변경했지만 오류는 여전히 존재합니다. 제발 좀 봐주세요 – paul

+0

오류가 있습니다 ur testng.xml ... 당신이 질문을 변경하고있다 ... 누군가가이 스레드를 참조 결코 어떤 도움을 얻지 못할거야. 나는 다른 스레드를 만들 것을 제안하고 싶습니다. 다른 오류 또는 replacin 대신 쓰레드에 데이터를 추가하십시오 ... U wud는 새로운 오류가있는 U를 도와 줄 누군가를위한 testng.xml 내용을 붙여 넣어야합니다 .. –

+0

하지만 testng.xml을 testng 스위트로 실행하면 잘 실행됩니다. – paul