2016-11-18 11 views
0

確信しているプラ​​グインとポストマンのプラグインを使用して、テストケースが合格した場合、添付ファイル付きメールを受信者に送信できます。テストケースの失敗で、私は次のエラーが発生しています。私は何が欠けているのか分からない。助けてください。テスト失敗時にメールを送信できません:Maven

目標org.apache.maven.pluginsを実行できませんでした:maven-surefire-plugin:2.18.1:プロジェクトのテスト(デフォルトテスト)FSmaven1:テストに失敗しました。

</project><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.ymedia</groupId> 
    <artifactId>FSmaven1</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

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

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

    <dependencies> 
    <dependency> 
     <groupId>org.testng</groupId> 
     <artifactId>testng</artifactId> 
     <version>6.8</version> 
    </dependency> 
    <dependency> 
     <groupId>org.seleniumhq.selenium</groupId> 
     <artifactId>selenium-java</artifactId> 
     <version>2.48.2</version> 
    </dependency> 
    <dependency> 
     <groupId>io.appium</groupId> 
     <artifactId>java-client</artifactId> 
     <version>3.4.1</version> 
    </dependency> 
     <dependency> 
     <groupId>org.seleniumhq.selenium</groupId> 
     <artifactId>selenium-server</artifactId> 
     <version>2.53.0</version> 
    </dependency> 
     <dependency> 
      <groupId>com.uttesh</groupId> 
      <artifactId>pdfngreport</artifactId> 
      <version>2.1.3</version> 
     </dependency> 
    </dependencies> 
    <build> 
     <plugins> 
     <!-- Suirefire plugin to run xml files --> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.18.1</version> 
       <configuration> 
        <suiteXmlFiles> 
       <!-- TestNG suite XML files --> 
        <suiteXmlFile>testng.xml</suiteXmlFile> 
        </suiteXmlFiles> 
       </configuration> 
      </plugin> 
      <!-- Post-Man plugin --> 
     <plugin> 
      <groupId>ch.fortysix</groupId> 
      <artifactId>maven-postman-plugin</artifactId> 
      <executions> 
       <execution> 

       <id>send a mail</id> 
       <phase>test</phase> 
       <goals> 
       <goal>send-mail</goal> 
       </goals> 
       <inherited>true</inherited> 

       <configuration> 
        <!-- From Email address --> 
        <from>XXX</from> 

        <!-- Email subject --> 
        <subject>Test Automation Report</subject> 

        <!-- Fail the build if the mail doesnt reach --> 
        <failonerror>false</failonerror> 

        <!-- host --> 
        <mailhost>smtp.gmail.com</mailhost> 
        <!-- port of the host --> 
        <mailport>465</mailport> 
        <mailssl>true</mailssl> 
        <mailAltConfig>true</mailAltConfig> 

        <!-- Email Authentication(USername and Password) --> 
        <mailuser>xxx</mailuser> 
        <mailpassword>xxx</mailpassword> 

        <receivers> 
         <!-- To Email address --> 
         <receiver>xxx</receiver> 
        </receivers> 

        <fileSets> 
        <fileSet> 
         <!-- Report directory Path --> 
         <directory>./reports</directory> 
         <includes> 
          <!-- Report file name --> 
          <include>*.pdf</include> 
         </includes> 
         <!-- Use Regular Expressions like **/*.html if you want all the html files to send--> 
         </fileSet> 
        </fileSets>    

       </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     </plugins> 

</build> 
+0

メールを送信することは、JenkinsのようなCIソリューションの仕事です。 – khmarbaise

答えて

0

あなたのビルドにMaven Failsafe pluginを追加してみてください。テスト失敗の場合でも安全に実行できます。それがあなたのために働いた場合は、私たちにお知らせください。

編集1<testFailureIgnore>true</testFailureIgnore>をSurefireプラグインの設定に追加できますか?

+0

私はpom.xmlファイルにMaven Failsafeプラグインを追加しました。まだケースが失敗した場合、Buildは失敗しています。 達人、フェイルセーフ・プラグイン 2.19.1<構成> \t \t \t \t \t \t \t \t \t \t testng.xml \t \t \t \t \t \t \t \t \t \t \t \t \t フェイルセーフ・統合テストあなたが助けるために 統合テスト 統合テスト apporva

+0

感謝。このcmdを使用した後で動作します:mvn clean install -Dmaven.test.failure.ignore = true – apporva

0

テストが失敗したため、Mavenの実行がメール送信プラグインに届くことはありません。これらの行をmaven-surefire-pluginの設定セクションに追加してください:

これで問題は解決します。

関連する問題