From c25dc26d6121488a5883f022c3aeb4cb737e7b65 Mon Sep 17 00:00:00 2001 From: Sebastian Arellanes Date: Tue, 3 Sep 2024 22:49:46 -0700 Subject: [PATCH] Print errors if there are any --- .github/workflows/pull_request.yml | 21 ++++++++++++++++--- .../controllers/AdminControllerSpec.scala | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index eafe4b0f..f3d2d366 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -42,12 +42,27 @@ jobs: run: CI=true sbt "testOnly controllers.AdminControllerSpec" - name: Print test results + if: failure() run: | - # Find all XML files in the target/test-reports directory + sudo apt-get update && sudo apt-get install -y libxml2-utils && + # Find all XML files in the server/target/test-reports directory for file in server/target/test-reports/*.xml; do if [ -f "$file" ]; then - echo "Contents of $file:" - cat "$file" + # check if file has tags + # dont print boolean + if xmllint --xpath 'boolean(//testsuite/testcase/failure)' "$file"; then + echo "Processing $file:" + # Extract and print tags inside tags + xmllint --xpath '//testsuite/testcase/failure/text()' "$file" + echo + fi + # echo "Processing $file:" + + # Extract and print tags inside tags + # xmllint --xpath '//testsuite/testcase/failure/text()' "$file" + # if there are tags, print classname and name attributes + # xmllint --xpath '//testsuite/testcase/failure/parent::testcase/@classname | //testsuite/testcase/failure/parent::testcase/@name' "$file" + echo else echo "No XML files found." diff --git a/server/src/test/scala/controllers/AdminControllerSpec.scala b/server/src/test/scala/controllers/AdminControllerSpec.scala index 7daeec2e..27fefe6a 100644 --- a/server/src/test/scala/controllers/AdminControllerSpec.scala +++ b/server/src/test/scala/controllers/AdminControllerSpec.scala @@ -67,6 +67,7 @@ class AdminControllerSpec extends PlayPostgresSpec with LoginUtils with MockitoS } "return no results" in withApiClient { client => + throw new NotImplementedError("Kappa error") val response = client.adminGetUserLogs(UUID.randomUUID()).futureValue response.data.isEmpty must be(true) }