user3595231
user3595231

Reputation: 767

How to generate allure report that carries the history information.

I have a bash script to run the selenium test case in docker. And last step of this script is to generate the allure report of the test results, such as:

 export ALLURE_IMAGE=beeete2/docker-allure2
 export PROJECT_DIR=selenium-suites
 export ALLURE_REPORT_DIR=allure-report
 export ALLURE_CONFIG_DIR=allure-config
 docker run --rm  \
           -v $(pwd)/$ALLURE_REPORT_DIR:/$ALLURE_REPORT_DIR \
           -v $(pwd)/$PROJECT_DIR/$ALLURE_RESULTS_DIR:/$ALLURE_RESULTS_DIR \
           -v $(pwd)/$PROJECT_DIR/$ALLURE_CONFIG_DIR:/$ALLURE_CONFIG_DIR \
           $ALLURE_IMAGE allure generate /$ALLURE_RESULTS_DIR -o /$ALLURE_REPORT_DIR --clean

If the report was 1st time created, this allure-report dir will be created and the whole directory structure would be as:

├── allure-report
│   ├── app.js
│   ├── data
│   ├── export
│   ├── favicon.ico
│   ├── history
│   ├── index.html
│   ├── plugins
│   ├── styles.css
│   └── widgets
├── selenium-suites
│   ├── allure-config
│   ├── ...

I want to know how do I keep the previous history, if I was to run the script for the 2nd, or 3rd time, and the latest allure report is created ?

I've googled and have found that I should have history part saved in a separate allure-results dir, before the next execution starts, such as:

if [[ -e ./allure-report/history ]]; then
    if [[ -e ./allure-results/history ]]; then
        rm -rf ./allure-results/history
    fi
    mv ./allure-report/history ./allure-results/history
fi

By this, It will try to save the latest allure-report/history part into allure-results/history, but I am not sure when the next execution is done, and is about to create a new report under allure-report, how does it know there is history saved under allure-results/... ?

Upvotes: 4

Views: 7004

Answers (2)

Frank Escobar
Frank Escobar

Reputation: 696

You can navigate through your history executions using this docker container: https://github.com/fescobar/allure-docker-service#keep-history-and-trends

Upvotes: 1

harmider
harmider

Reputation: 431

What you need to do is just to copy (and replace) content of the history folder

  • from: allure-report/history/
  • to: allure-results/history/

Of course, you need to specify the location of the folders based on the structure of your project.

Once you run allure generate, it will take the files from the last run and also will search for history files (in the path: allure-results/history)

After generating the report, allure posts new files into allure-report folder and groups all the previous runs into the history files again (allure-report/history/)

Upvotes: 1

Related Questions