2017-07-24 162 views
0

我是新來的自動化,並不明白爲什麼我的編譯顯示失敗的控制檯窗口時,我通過pom.xml執行testng.xml雖然測試執行良好。通過pom.xml運行testng.xml,但構建失敗,雖然沒有測試失敗

複製我的pom.xml和可能有用的錯誤。如果有需要的東西,請告訴我。您的幫助將不勝感激。

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>com.bookbaby.tests</groupId> 
    <artifactId>CucumberTestNGMaven</artifactId> 
    <version>1.0-SNAPSHOT</version> 

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

    <dependencies> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-junit</artifactId> 
      <version>1.2.5</version> 
     </dependency> 

     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-java</artifactId> 
      <version>1.2.5</version> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-core</artifactId> 
      <version>1.2.5</version> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-jvm-deps</artifactId> 
      <version>1.0.5</version> 
     </dependency> 
     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-server</artifactId> 
      <version>3.4.0</version> 
     </dependency> 

     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-testng</artifactId> 
      <version>1.2.5</version> 
     </dependency> 


     <dependency> 
      <groupId>net.masterthought</groupId> 
      <artifactId>cucumber-reporting</artifactId> 
      <version>3.7.0</version> 
     </dependency> 

     <!-- <dependency> 
      <groupId>com.fasterxml.jackson.dataformat</groupId> 
      <artifactId>jackson-dataformat-yaml</artifactId> 
      <version>2.3.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.fasterxml.jackson.core</groupId> 
      <artifactId>jackson-databind</artifactId> 
      <version>2.2.3</version> 
     </dependency> --> 
     <!-- <dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-lang3</artifactId> 
      <version>3.4</version> 
     </dependency> --> 
     <dependency> 
      <groupId>org.apache.logging.log4j</groupId> 
      <artifactId>log4j-api</artifactId> 
      <version>2.6.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.logging.log4j</groupId> 
      <artifactId>log4j-core</artifactId> 
      <version>2.6.1</version> 
     </dependency> 
     <dependency> 
      <groupId>javax.mail</groupId> 
      <artifactId>mail</artifactId> 
      <version>1.4</version> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
     <!-- This plugin is used to run java main class file --> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.6.1</version> 
       <configuration> 
        <compilerVersion>1.8</compilerVersion> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 

      <!-- This plugin is used to run java main class file --> 
      <!-- <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>exec-maven-plugin</artifactId> 
       <version>1.6.0</version> 

       <executions> 
        <execution> 
         <phase>test</phase> 
         <goals> 
          <goal>java</goal> 
         </goals> 
         <configuration> 
          <mainClass>com.bookbaby.executor.RunSuite</mainClass> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> --> 

    <!-- To run testNg.xml we need below plugin --> 
    <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-surefire-plugin</artifactId> 
     <version>2.20</version> 
     <!-- <inherited>true</inherited> --> 
     <configuration> 
       <suiteXmlFiles> 
        <suiteXmlFile>testngSingle.xml</suiteXmlFile> 
       </suiteXmlFiles> 
        <skipTests>false</skipTests> 
       <properties> 
        <property> 
         <name>suitethreadpoolsize</name> 
         <value>3</value> 
        </property> 
       </properties> 
       <testFailureIgnore>false</testFailureIgnore> 
      </configuration> 

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

誤差小於

[INFO] Scanning for projects... [INFO] 
    [INFO]------------------------------------------------------------------------ [INFO] 
Building CucumberTestNGMaven 1.0-SNAPSHOT [INFO] 
------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources 
(default-resources) @ CucumberTestNGMaven --- [INFO] Using 'UTF-8' 
encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ 
CucumberTestNGMaven --- [INFO] Changes detected - recompiling the 
module! [INFO] Compiling 41 source files to 
C:\Users\Refaque\workspace\CucumberTestNGMavenParallelRunTestng\target\classes 
[INFO] [INFO] --- maven-resources-plugin:2.6:testResources 
(default-testResources) @ CucumberTestNGMaven --- [INFO] Using 'UTF-8' 
encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:testCompile 
(default-testCompile) @ CucumberTestNGMaven --- [INFO] Nothing to 
compile - all classes are up to date [INFO] [INFO] --- 
maven-surefire-plugin:2.20:test (default-test) @ CucumberTestNGMaven 
--- [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- 
[INFO] Running TestSuite doing set up in RunCukesByFeatureForFirefox 
Jul 24, 2017 4:13:08 PM org.openqa.selenium.remote.ProtocolHandshake 
createSession INFO: Detected dialect: OSS RemoteWebDriver: firefox on 
ANY (2f84874a-05a3-48ae-8884-5ca277ff7f54) Hooks Executing 
RemoteWebDriver: firefox on ANY (2f84874a-05a3-48ae-8884-5ca277ff7f54) 
EXECUTING SCENARIO >>>Successfull login functionality Searching 
element By.xpath: //a[@class='wisepop-close'] for presence, will wait 
by 30 seconds Searching element By.xpath: //*[@id='login-link']/span 
for presence, will wait by 30 seconds Searching element 
By.cssSelector: 
input[id="ctl00_ctl00_cphContent_cphContent_txtUserName"] for 
> presence, will wait by 30 seconds Searching element By.cssSelector: 
> input[id="ctl00_ctl00_cphContent_cphContent_txtPassword"] for 
> presence, will wait by 30 seconds Searching element By.id: 
> ctl00_ctl00_cphContent_cphContent_btnLogin for presence, will wait by 
> 30 seconds Searching element By.xpath: 
> //*[@id='header-menu']/div[2]/a/img for presence, will wait by 30 
> seconds 
> 
> 1 Scenarios ([32m1 passed[0m) 8 Steps ([32m8 passed[0m) 0m19.141s 
> 
> executing after suite [INFO] Tests run: 1, Failures: 0, Errors: 0, 
> Skipped: 0, Time elapsed: 56.446 s - in TestSuite [INFO] [INFO] 
> Results: [INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 
> 0 [INFO] [INFO] 
> ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] 
> ------------------------------------------------------------------------ [INFO] Total time: 01:00 min [INFO] Finished at: 
> 2017-07-24T16:13:51+01:00 [INFO] Final Memory: 22M/315M [INFO] 
> ------------------------------------------------------------------------ [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-surefire-plugin:2.20:test 
> (default-test) on project CucumberTestNGMaven: There are test 
> failures. [ERROR] [ERROR] Please refer to 
> C:\Users\Refaque\workspace\CucumberTestNGMavenParallelRunTestng\target\surefire-reports 
> for the individual test results. [ERROR] Please refer to dump files 
> (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and 
> [date]-jvmRun[N].dumpstream. [ERROR] Error occurred in starting fork, 
> check output in log [ERROR] 
> org.apache.maven.surefire.booter.SurefireBooterForkException: Error 
> occurred in starting fork, check output in log [ERROR] at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:634) 
> [ERROR] at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533) 
> [ERROR] at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:279) 
> [ERROR] at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:243) 
> [ERROR] at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1077) 
> [ERROR] at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:907) 
> [ERROR] at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:785) 
> [ERROR] at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
> [ERROR] at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 
> [ERROR] at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
> [ERROR] at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
> [ERROR] at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 
> [ERROR] at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
> [ERROR] at 
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 
> [ERROR] at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 
> [ERROR] at 
> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) [ERROR] 
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
> [ERROR] at 
> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) [ERROR] 
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) [ERROR] at 
> org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) [ERROR] at 
> org.apache.maven.cli.MavenCli.main(MavenCli.java:199) [ERROR] at 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> [ERROR] at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
> [ERROR] at java.lang.reflect.Method.invoke(Method.java:498) [ERROR] at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 
> [ERROR] at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 
> [ERROR] at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 
> [ERROR] at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
> [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/MojoExecutionException` 
+0

格式化XML。當你錯誤地格式化它時,它不會顯示,因爲瀏覽器嘗試將它解釋爲HTML – litelite

+0

你嘗試添加,如https://stackoverflow.com/questions/9320620/junit-maven-error-occured-in-開始叉檢查輸出入日誌?你的衣服尺碼的目標是什麼?你有沒有嘗試評論它?我的意思是完整的屬性定義 –

+0

@ yohann.martineau 2 - 註釋掉了完整的屬性定義並添加了,但仍然沒有運氣。 – Ref

回答

0

我自己懂了工作,加入永不雖然yohann.martineau 21建議我用 「曾經」,它沒有工作但「從不」爲我工作。感謝大家。

相關問題