From 8442afd8f601798ad66fb1b88ed2cf9f581cbfe8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?=
 <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de>
Date: Mon, 26 Dec 2022 11:48:14 +0100
Subject: [PATCH] Visualize unit test results in GitLab

---
 .gitlab-ci.yml            | 3 ++-
 AKPlanning/settings_ci.py | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f62a299b..51954c1e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -35,7 +35,7 @@ test:
   script:
     - source venv/bin/activate
     - echo "GRANT ALL on *.* to '${MYSQL_USER}';"| mysql -u root --password="${MYSQL_ROOT_PASSWORD}" -h mysql
-    - pip install pytest-cov
+    - pip install pytest-cov unittest-xml-reporting
     - coverage run --source='.' manage.py test --settings AKPlanning.settings_ci
     - coverage report
     - coverage xml
@@ -45,3 +45,4 @@ test:
       coverage_report:
         coverage_format: cobertura
         path: coverage.xml
+      junit: unit.xml
diff --git a/AKPlanning/settings_ci.py b/AKPlanning/settings_ci.py
index 77f75f4e..c8e6a62e 100644
--- a/AKPlanning/settings_ci.py
+++ b/AKPlanning/settings_ci.py
@@ -24,3 +24,6 @@ DATABASES = {
         },
     }
 }
+
+TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner'
+TEST_OUTPUT_FILE_NAME = 'unit.xml'
-- 
GitLab