Skip to content

Commit af13d28

Browse files
Feature/user service tests (#62)
2 parents 6072057 + 265c76b commit af13d28

File tree

16 files changed

+580
-9
lines changed

16 files changed

+580
-9
lines changed

.github/workflows/build_application.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ on:
1010

1111
jobs:
1212

13-
# Run tests (unimplemented)
14-
# test:
15-
# name: Run Tests
16-
# uses: ./.github/workflows/test_application.yml
13+
# Run tests
14+
test:
15+
name: Run Tests
16+
uses: ./.github/workflows/java_tests.yml
1717

1818
# Call the docker_build workflow to build and publish images
1919
build:
2020
name: Build & Publish Images
21-
uses: ./.github/workflows/docker_build.yml
21+
uses: ./.github/workflows/docker_build.yml
22+
needs: test

.github/workflows/java_tests.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This workflow should build docker images every time code is pushed to the repository
2+
name: Test Java Applications
3+
4+
# This workflow is triggered only when called by another workflow
5+
on:
6+
workflow_call:
7+
8+
jobs:
9+
10+
test:
11+
name: Run tests on java applications
12+
runs-on: ubuntu-latest
13+
14+
# Use a matrix strategy to run the tests for all applications
15+
strategy:
16+
matrix:
17+
# Add any future services relative paths from . here
18+
service: [user]
19+
20+
steps:
21+
22+
- name: Check out repository
23+
uses: actions/checkout@v3
24+
25+
- name: Setup JDK
26+
uses: actions/setup-java@v3
27+
with:
28+
distribution: temurin
29+
java-version: 17
30+
31+
- name: Make Gradle wrapper executable
32+
run: chmod +x gradlew
33+
working-directory: server/${{ matrix.service }}
34+
35+
- name: Run tests
36+
run: ./gradlew test --info
37+
working-directory: server/${{ matrix.service }}
38+
39+
# Upload the junit reports as artifacts
40+
- name: Upload JUnit test reports
41+
if: always()
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: junit-test-results
45+
path: |
46+
server/${{ matrix.service }}/build/test-results
47+
server/${{ matrix.service }}/build/reports/tests
48+
49+
# Add annotations to checks tab
50+
- name: Report Tests
51+
if: always()
52+
uses: dorny/test-reporter@v2
53+
with:
54+
name: ${{ matrix.service }}
55+
path: ./server/${{ matrix.service }}/build/test-results/**/*.xml
56+
reporter: java-junit
57+
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ sketch
382382
HELP.md
383383
.gradle
384384
build/
385-
!gradle/wrapper/gradle-wrapper.jar
385+
!**/gradle/wrapper/gradle-wrapper.jar
386386
!**/src/main/**/build/
387387
!**/src/test/**/build/
388388

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
![Meet@Mensa logo](resources/img/[email protected] "Meet@Mensa")
44

5+
[![Build & Test Meet@Mensa](https://github.com/AET-DevOps25/team-devoops/actions/workflows/build_application.yml/badge.svg)](https://github.com/AET-DevOps25/team-devoops/actions/workflows/build_application.yml)
6+
57
Many students at TUM, particularly in the larger study programs, report feeling lonely and isolated despite having countless peers. One of the places where this is especially noticeable is the Mensa during lunchtime. It's common for students that don't have a strong network of friends at university to eat alone or avoid eating at the Mensa entirely to not feel socially awkward.
68

79
Our tool - *Meet@Mensa* - focuses on transforming the potentially uncomfortable situation of eating alone at the Mensa into an opportunity to meet fellow students and make new friends. In order to enable this, our tool offers the following features:
42.7 KB
Binary file not shown.
42.7 KB
Binary file not shown.
42.7 KB
Binary file not shown.

server/user/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ dependencies {
2222
implementation 'org.springframework.boot:spring-boot-starter-web'
2323
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
2424
testImplementation 'org.springframework.boot:spring-boot-starter-test'
25+
testImplementation 'org.testcontainers:testcontainers:1.21.3'
26+
testImplementation 'org.testcontainers:mysql:1.21.3'
27+
testImplementation "org.testcontainers:junit-jupiter:1.21.3"
2528
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
2629
runtimeOnly 'com.mysql:mysql-connector-j:9.3.0'
2730
}
42.7 KB
Binary file not shown.
42.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)