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/... ?