Skip to content

Commit

Permalink
Merge #6982
Browse files Browse the repository at this point in the history
6982: Added ability to easily review summary of test results r=jmcameron a=jmcameron

Adds a simplified way to print a summary of regression tests results.

This PR also disables the broken protractor end-to-end tests.

Note that this change copies the output of each test into a 'report' file in the respective test directories.  The summary comes by grepping for relevant totals lines in each 'report' file.  Note that this always shows the results from the current versions of the 'report' file, even if it is stale.  Obviously this could be improved with a smarter script but this is a start.  

### Testing
- Use bhima_test
- run 'yarn test'
- Should print an abbreviated summary of the test results from all four tests.
- Run 'yarn test:show-results' to see the results again (without running the tests)


Co-authored-by: Jonathan Cameron <jmcameron@gmail.com>
  • Loading branch information
bors[bot] and jmcameron authored Apr 3, 2023
2 parents 2efc16a + 17dc7b5 commit a1df5dd
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ docs/.sass-cache/

client/upload/

test/*/report

migration-*.sql
yarn-error.log
*.log
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"test:ends": "cross-env SUITE=\"end-to-end\" ./sh/test.sh",
"test:client-unit": "cross-env SUITE=\"client-unit\" ./sh/test.sh",
"test:server-unit": "cross-env SUITE=\"server-unit\" ./sh/test.sh",
"test:show-results": "./sh/show-test-results.sh",
"build": "cross-env ./node_modules/.bin/gulp build",
"build:db": "cross-env ./sh/build-database.sh",
"build:clean": "cross-env ./sh/build-init-database.sh",
Expand Down
2 changes: 1 addition & 1 deletion sh/integration-stock-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ echo "[test] Spawning server process..."

echo "[test] running tests using mocha"
# run the tests
./node_modules/.bin/mocha --recursive --bail --exit ./test/integration-stock/
./node_modules/.bin/mocha --recursive --bail --exit ./test/integration-stock/ 2>&1 | tee ./test/integration-stock/report

echo "[/test]"
2 changes: 1 addition & 1 deletion sh/integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ echo "[test] building the server..."

echo "[test] running tests using mocha"
# run the tests
./node_modules/.bin/mocha --recursive --bail --exit --timeout 20000 ./test/integration/
./node_modules/.bin/mocha --recursive --bail --exit --timeout 20000 ./test/integration/ 2>&1 | tee ./test/integration/report

echo "[/test]"
19 changes: 19 additions & 0 deletions sh/show-test-results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

echo "TEST RESULTS SUMMARY"
echo
echo "Client Unit Tests"
echo " " `grep "TOTAL" ./test/client-unit/report`
echo
echo "Client Unit Tests"
echo " " `grep 'passing' ./test/server-unit/report`
echo " " `grep 'failing' ./test/server-unit/report`
echo
echo "Integration Tests"
echo " " `grep passing ./test/integration/report`
echo " " `egrep -e '(failing|pending)' ./test/integration/report`
echo
echo "Stock Integration Tests"
echo " " `grep passing ./test/integration-stock/report`
echo " " `egrep -e '(failing|pending)' ./test/integration-stock/report`
echo
7 changes: 5 additions & 2 deletions sh/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SUITE=${SUITE:-"ALL"}
# run karma (client unit) tests
if [ $SUITE = "client-unit" ] || [ $SUITE = "ALL" ] ; then
startfold "Running Client Unit Tests..." "test-client-unit";
./node_modules/.bin/karma start --single-run --no-auto-watch karma.conf.js
./node_modules/.bin/karma start --single-run --no-auto-watch karma.conf.js 2>&1 | tee ./test/client-unit/report
endfold "test-client-unit" ;
fi

Expand All @@ -43,7 +43,7 @@ fi
# run server-unit test
if [ $SUITE = "server-unit" ] || [ $SUITE = "ALL" ] ; then
startfold "Running server Unit Tests ......" "server-unit"
./node_modules/.bin/mocha --recursive --exit test/server-unit
./node_modules/.bin/mocha --recursive --exit test/server-unit 2>&1 | tee ./test/server-unit/report
endfold "server-unit" ;
fi

Expand All @@ -60,4 +60,7 @@ fi
# endfold "test-end-to-end" ;
# fi

# Show summary of results
./sh/show-test-results.sh

exit 0;

0 comments on commit a1df5dd

Please sign in to comment.