OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Extent Report is not Generating when I run the test in GitHub Actions

  • Thread starter Thread starter Royce Elland
  • Start date Start date
R

Royce Elland

Guest
I'm using Selenium, SpecFlow, and C#

Locally when I run my automation test, the extent report is generating successfully together with the screenshots.

Code:
private static string dir = AppDomain.CurrentDomain.BaseDirectory;
private static string testResultPath = dir.Replace("\\bin\\Debug\\net6.0", "\\test-output");

public static void ExtentReportInit()
{
    var _htmlReport = new ExtentSparkReporter(@testResultPath + "index.html");
    _htmlReport.Config.ReportName = "Automation Status Report";
    _htmlReport.Config.DocumentTitle = "Automation Status Report";
    _htmlReport.Config.Theme = Theme.Standard;

    _extentReports = new ExtentReports();
    _extentReports.AttachReporter(_htmlReport);
}

However, when I'm running it in GitHub Actions the report is not generating, but the screenshot is generating and uploading.

Code:
private static string testResultPath = Path.Combine(Environment.GetEnvironmentVariable("GITHUB_WORKSPACE")!, "test-output");

public static void ExtentReportInit()
{
    var _htmlReport = new ExtentSparkReporter(@testResultPath + "index.html");
    _htmlReport.Config.ReportName = "Automation Status Report";
    _htmlReport.Config.DocumentTitle = "Automation Status Report";
    _htmlReport.Config.Theme = Theme.Standard;

    _extentReports = new ExtentReports();
    _extentReports.AttachReporter(_htmlReport);
}

Here is my github actions for reference

Code:
# ... bunch of code before these codes ...

    - name: Create report directory
      run: mkdir -p ${{github.workspace}}/test-output

    - name: Test
      run: dotnet test projectName.csproj --configuration Release
    
    - name: Upload Report
      uses: actions/upload-artifact@v2
      if: always()
      with:
        name: test-results
        path: ${{github.workspace}}/test-output

base on my investigations and tried different solutions, the main issue here is i cannot generate the html file only.
<p>I'm using Selenium, SpecFlow, and C#</p>
<p>Locally when I run my automation test, the extent report is generating successfully together with the screenshots.</p>
<pre><code>private static string dir = AppDomain.CurrentDomain.BaseDirectory;
private static string testResultPath = dir.Replace("\\bin\\Debug\\net6.0", "\\test-output");

public static void ExtentReportInit()
{
var _htmlReport = new ExtentSparkReporter(@testResultPath + "index.html");
_htmlReport.Config.ReportName = "Automation Status Report";
_htmlReport.Config.DocumentTitle = "Automation Status Report";
_htmlReport.Config.Theme = Theme.Standard;

_extentReports = new ExtentReports();
_extentReports.AttachReporter(_htmlReport);
}
</code></pre>
<p>However, when I'm running it in GitHub Actions the report is not generating, but the screenshot is generating and uploading.</p>
<pre><code>private static string testResultPath = Path.Combine(Environment.GetEnvironmentVariable("GITHUB_WORKSPACE")!, "test-output");

public static void ExtentReportInit()
{
var _htmlReport = new ExtentSparkReporter(@testResultPath + "index.html");
_htmlReport.Config.ReportName = "Automation Status Report";
_htmlReport.Config.DocumentTitle = "Automation Status Report";
_htmlReport.Config.Theme = Theme.Standard;

_extentReports = new ExtentReports();
_extentReports.AttachReporter(_htmlReport);
}
</code></pre>
<p>Here is my github actions for reference</p>
<pre><code># ... bunch of code before these codes ...

- name: Create report directory
run: mkdir -p ${{github.workspace}}/test-output

- name: Test
run: dotnet test projectName.csproj --configuration Release

- name: Upload Report
uses: actions/upload-artifact@v2
if: always()
with:
name: test-results
path: ${{github.workspace}}/test-output
</code></pre>
<p>base on my investigations and tried different solutions, the main issue here is i cannot generate the html file only.</p>
Continue reading...
 

Latest posts

Top