Github 操作 - 无法在 Allure 报告上写入错误

问题描述 投票:0回答:0

我正在使用以下项目:

  1. 爪哇 - 11
  2. 专家
  3. 测试NG
  4. Selenium Webdriver
  5. 倾城报告

在本地机器上一切正常,但是当我在 Github 操作上运行时,我收到错误并且没有生成诱惑报告。

错误是:

 io.qameta.allure.AllureResultsWriteException: Could not write Allure test result container
Error:      at io.qameta.allure.FileSystemResultsWriter.write(FileSystemResultsWriter.java:68)
Error:      at io.qameta.allure.AllureLifecycle.writeTestContainer(AllureLifecycle.java:170)
Error:      at io.qameta.allure.testng.AllureTestNg.onFinish(AllureTestNg.java:195)
Error:      at org.testng.SuiteRunner.invokeListeners(SuiteRunner.java:269)
Error:      at org.testng.SuiteRunner.run(SuiteRunner.java:332)
Error:      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
Error:      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
Error:      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1256)
Error:      at org.testng.TestNG.runSuitesLocally(TestNG.java:1176)
Error:      at org.testng.TestNG.runSuites(TestNG.java:1099)
Error:      at org.testng.TestNG.run(TestNG.java:1067)
Error:      at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:295)
Error:      at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84)
Error:      at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:90)
Error:      at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
Error:      at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
Error:      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Error:  Caused by: java.io.FileNotFoundException: allure-results/94d424ca-48b8-454e-b49d-d398a77c5cab-container.json (Permission denied)
Error:      at java.base/java.io.FileOutputStream.open0(Native Method)
Error:      at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
Error:      at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
Error:      at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:187)
Error:      at com.fasterxml.jackson.core.TokenStreamFactory._fileOutputStream(TokenStreamFactory.java:278)
Error:      at com.fasterxml.jackson.core.JsonFactory.createGenerator(JsonFactory.java:1369)
Error:      at com.fasterxml.jackson.databind.ObjectMapper.createGenerator(ObjectMapper.java:1230)
Error:      at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3811)
Error:      at io.qameta.allure.FileSystemResultsWriter.write(FileSystemResultsWriter.java:66)
Error:      ... 16 more 

下面是我的 Github YML 文件:

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Stage - Automation

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - name: Set up JDK 11
      uses: actions/setup-java@v3
      with:
        java-version: '11'
        distribution: 'temurin'
        cache: maven
    - name: Install Google Chrome #Using shell script to install Google Chrome
      run:   |
              chmod +x ./scripts/InstallChrome.sh
                          ./scripts/InstallChrome.sh
                          
    - name: Build with Maven
      run: mvn test -P placeOrder_stage -Denv=stage


    - name: Test marketplace action
      uses: simple-elf/allure-report-action@master
      if: always()
      id: allure-report
      with:
        allure_results: allure-results/Reports/*
        gh_pages: gh-pages
        allure_report: allure-report
        allure_history: allure-history


    - name: Deploy report to Github Pages
      if: always()
      uses: peaceiris/actions-gh-pages@v2
      env:
        PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        PUBLISH_BRANCH: gh-pages
        PUBLISH_DIR: allure-history
java maven selenium-webdriver github-actions allure
© www.soinside.com 2019 - 2024. All rights reserved.