zerocode icon indicating copy to clipboard operation
zerocode copied to clipboard

[REPORT]Persist report and run-log files to an external space after all tests executions

Open nirmalchandra opened this issue 4 months ago • 3 comments

The Problem

In many projects, Jenkins-slaves, containerized environments, or VMs (like those used in GitLab and GitHub) are the backbone of CI/CD pipelines. These environments run the critical jobs, but there's a catch: the test result reports often aren’t saved for long-term reference, and access is restricted or controlled, leaving reports inaccessible. Sometimes, even the target folder is out of reach.

These reports—ranging from CSV files to HTML-Dashboard summary file and log files—are crucial for investigating test failures. But with limited access or short retention, developers and SDETs struggle to conduct thorough analyses. The inability to easily retrieve evidence hinders the ability to back up test failures and diagnose root causes, making the process more frustrating and less efficient.

Solution:

Implement a mechanism to allow configurable external space to save/persist the reports(csv, html and log files).

Example 1: Use an external git repo "test-reports" to push the test-reports to this repo.

config properties entry:

reports.repo=https://github.com/authorjapps/test-reports
reports.repo.token:<use an authentication token>
reports.repo.max.upload.limit.mb=2   #<----- can be configured for more or less if needed

AC1: Limit the "upload" to 2mb max of each file by default, unless configured for different size via reports.repo.max.upload.limit.mb

AC2: If due to some reason, the upload did not succeed, then do not fail the build, instead log an Error message (WARN level) e.g. "Something went wrong while pushing reports files to an external space. Please fix the connectivity and rerun. You can ignore this failure message as it had no effect on the CI build".

AC3: Push only the below 4 files:

- target/surefire-reports/*.xml <--- 1 XMl file (pick via <*.log> pattern, if more files present, then validate via AC1)
- target/zerocode-junit-interactive-fuzzy-search.html
- target/zerocode-junit-granular-report.csv
- target/logs/*.log <--- 1 log file (pick via <*.log> pattern, as this is custom named per project. Also, validate via AC1>

nirmalchandra avatar Oct 08 '24 21:10 nirmalchandra