Cucumber 与 Jenkins 的集成在远程机器上成功构建,但在带有 net.serenity-bdd 插件的 Serenity Reports 中有黑色屏幕截图

问题描述

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>OBM12-Cucumber</groupId>
    <artifactId>OBM12-Cucumber</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <cucumber.version>5.6.0</cucumber.version>
        <junit.version>4.13</junit.version>
        <serenity.version>2.2.8</serenity.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-core -->
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <version>${serenity.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>io.cucumber</groupId>
                    <artifactId>cucumber-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-screenplay</artifactId>
            <version>${serenity.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>io.cucumber</groupId>
                    <artifactId>cucumber-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- https://mvnrepository.com/artifact/net.serenity-bdd/serenity-cucumber5 -->
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-cucumber5</artifactId>
            <version>2.2.5</version>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.6.1</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.0</version>
                <configuration>
                    <!-- <parallel>methods</parallel>
                    <useUnlimitedThreads>true</useUnlimitedThreads> -->
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.serenity-bdd.maven.plugins</groupId>
                <artifactId>serenity-maven-plugin</artifactId>
                <version>${serenity.version}</version>
                <executions>
                    <execution>
                        <id>serenity-reports</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Jenkins Test Screenshots


-------------------------------------------------------------------------------------
     _______. _______ .______       _______ .__   __.  __  .___________.____    ____ 
    /       ||   ____||   _  \     |   ____||  \ |  | |  | |           |\   \  /   / 
   |   (----`|  |__   |  |_)  |    |  |__   |   \|  | |  | `---|  |----` \   \/   /  
    \   \    |   __|  |      /     |   __|  |  . `  | |  |     |  |       \_    _/   
.----)   |   |  |____ |  |\  \----.|  |____ |  |\   | |  |     |  |         |  |     
|_______/    |_______|| _| `._____||_______||__| \__| |__|     |__|         |__|    
                                                                                     
 News and tutorials at http://www.serenity-bdd.info                                  
 Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/             
 Join the Serenity Community on Gitter: https://gitter.im/serenity-bdd/serenity-core 
 Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport  
-------------------------------------------------------------------------------------

1506 [main] INFO  - Test Suite Started: Access search
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/account_info_edit/account_info_edit.feature
1527 [main] INFO  - Test Suite Started: View/Edit-Account information tab
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/ban_export_as_csv/ban_export_as_csv.feature
1532 [main] INFO  - Test Suite Started: View/Edit-Billing account numbers tab
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/login/login.feature
1546 [main] INFO  - Test Suite Started: Login
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/manage_account/manage_account.feature
1551 [main] INFO  - Test Suite Started: Navigate through the manage account screens,get to BAN Tab and click on Add
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/mcmt_search/mcmt_search.feature
1556 [main] INFO  - Test Suite Started: Message search
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/multiple_account_selection/multiple_account_selection.feature
1560 [main] INFO  - Test Suite Started: Multiple account selection
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/paper_suppression/paper_suppression_filter.feature
1565 [main] INFO  - Test Suite Started: Validate  CSR-Registration -Paper suppression - Filter functionality
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/paper_suppression/paper_suppression_update.feature
1573 [main] INFO  - Test Suite Started: Paper suppression screen
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/payment_method/payment_method.feature
1577 [main] INFO  - Test Suite Started: CSR-View/Edit-Payment Method- Save functionality
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/preauthorized_payment/preauthorized_payment.feature
1582 [main] INFO  - Test Suite Started: Pre Authorized Payment
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/single_account_selection/single_account_selection.feature
1586 [main] INFO  - Test Suite Started: single account selection
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/transaction_logs/transaction_logs_search.feature
1589 [main] INFO  - Test Suite Started: Reports- Transaction log search
Feature from file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/src/test/resources/features/ban_export_as_csv/ban_export_as_csv.feature
1899 [main] INFO  - 
 _____ _____ ____ _____   ____ _____  _    ____ _____ _____ ____  
|_   _| ____/ ___|_   _| / ___|_   _|/ \  |  _ \_   _| ____|  _ \ 
  | | |  _| \___ \ | |   \___ \ | | / _ \ | |_) || | |  _| | | | |
  | | | |___ ___) || |    ___) || |/ ___ \|  _ < | | | |___| |_| |
  |_| |_____|____/ |_|   |____/ |_/_/   \_\_| \_\|_| |_____|____/ 

Check validation for Export csv file(view/edit-billing-account-numbers-tab;check-validation-for-export-csv-file)
-------------------------------------------------------------------
2137 [main] WARN net.thucydides.core.requirements.model.cucumber.CucumberParser - Couldn't read the feature file D:\IDR REG GITLAB\code\OBM12-Cucumber\src\test\resources\features\add_ban\add_ban.feature - it will be ignored
2160 [main] WARN net.thucydides.core.requirements.model.cucumber.CucumberParser - Couldn't read the feature file D:\IDR REG GITLAB\code\OBM12-Cucumber\src\test\resources\features\delete_ban\delete_ban.feature - it will be ignored
3103 [main] INFO net.serenitybdd.core.webdriver.driverproviders.ProvideNewDriver - Instantiating driver
3105 [main] INFO net.serenitybdd.core.webdriver.driverproviders.ProvideNewDriver - Driver capabilities: Capabilities {browserName: internet explorer,ensureCleanSession: true,ignoreZoomSetting: true,javascriptEnabled: true,loggingPrefs: org.openqa.selenium.logging...,nativeEvents: true,platform: WINDOWS,requireWindowFocus: false,takesScreenshot: true,version: }
Started InternetExplorerDriver server (64-bit)
3.150.1.0
Listening on port 44862
Only local connections are allowed
Apr 16,2021 5:10:11 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
145774 [main] INFO  - 
        __    _____ _____ ____ _____   ____   _    ____  ____  _____ ____  
  _     \ \  |_   _| ____/ ___|_   _| |  _ \ / \  / ___|/ ___|| ____|  _ \ 
 (_)_____| |   | | |  _| \___ \ | |   | |_) / _ \ \___ \\___ \|  _| | | | |
  _|_____| |   | | | |___ ___) || |   |  __/ ___ \ ___) |___) | |___| |_| |
 (_)     | |   |_| |_____|____/ |_|   |_| /_/   \_\____/|____/|_____|____/ 
        /_/                                                                

Check validation for Export csv file
----------------------------------------------------------------------------

1 Scenarios (1 passed)
7 Steps (7 passed)
2m24.594s


146010 [pool-2-thread-1] WARN net.thucydides.core.requirements.model.cucumber.CucumberParser - Couldn't read the feature file D:\IDR REG GITLAB\code\OBM12-Cucumber\src\test\resources\features\add_ban\add_ban.feature - it will be ignored
146028 [pool-2-thread-1] WARN net.thucydides.core.requirements.model.cucumber.CucumberParser - Couldn't read the feature file D:\IDR REG GITLAB\code\OBM12-Cucumber\src\test\resources\features\delete_ban\delete_ban.feature - it will be ignored
[INFO] Tests run: 1,Failures: 0,Errors: 0,Skipped: 0,Time elapsed: 148.002 s - in com.bch.obm.runcucumberTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1,Skipped: 0
[INFO] 
[JENKINS] Recording test results
[INFO] 
[INFO] -------------------< OBM12-Cucumber:OBM12-Cucumber >--------------------
[INFO] Building OBM12-Cucumber 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- serenity-maven-plugin:2.2.8:aggregate (default-cli) @ OBM12-Cucumber ---
[WARNING] Couldn't read the feature file D:\IDR REG GITLAB\code\OBM12-Cucumber\src\test\resources\features\add_ban\add_ban.feature - it will be ignored
[WARNING] Couldn't read the feature file D:\IDR REG GITLAB\code\OBM12-Cucumber\src\test\resources\features\delete_ban\delete_ban.feature - it will be ignored
[WARNING] Couldn't read the feature file D:\IDR REG GITLAB\code\OBM12-Cucumber\src\test\resources\features\delete_ban\delete_ban.feature - it will be ignored
[WARNING] Couldn't read the feature file D:\IDR REG GITLAB\code\OBM12-Cucumber\src\test\resources\features\add_ban\add_ban.feature - it will be ignored
[INFO] Test results for 1 tests generated in 3.2 secs in directory: file:/D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/target/site/serenity/
[INFO] -----------------------------------------
[INFO]  SERENITY TESTS : SUCCESS
[INFO] -----------------------------------------
[INFO] | Tests executed         | 1
[INFO] | Tests passed           | 1
[INFO] | Tests Failed           | 0
[INFO] | Tests with errors      | 0
[INFO] | Tests compromised      | 0
[INFO] | Tests pending          | 0
[INFO] | Tests ignored/skipped  | 0
[INFO] ------------------------ | --------------
[INFO] | Total Duration         | 2m 24s
[INFO] | Fastest test took      | 2m 23s
[INFO] | Slowest test took      | 2m 23s
[INFO] -----------------------------------------
[INFO] 
[INFO] SERENITY REPORTS
[INFO]   - Full Report: file:///D:/IDR%20REG%20GITLAB/code/OBM12-Cucumber/target/site/serenity/index.html
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:46 min
[INFO] Finished at: 2021-04-16T05:12:42-04:00
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving D:\IDR REG GITLAB\code\OBM12-Cucumber\pom.xml to OBM12-Cucumber/OBM12-Cucumber/0.0.1-SNAPSHOT/OBM12-Cucumber-0.0.1-SNAPSHOT.pom
channel stopped
Finished: SUCCESS

现在当我打开完整报告文件时,我看到如下所示的 Serenity BDD 报告:

Report images Report images

请注意 Jenkins 作为服务运行,我的服务器位于远程机器上,我已经设置了 Jenkins,通过将根 pom 指向部署的代码库来在远程服务器上运行测试如下图所示:

Build configuration on Jenkins

*请帮助我解决这个问题并生成测试场景截图。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)