This is a repository to collect JUnit Tests for GAD exercises at TUM in SoSe23. These tests have been written by students for students and are not part of the official course.
Es ist alles erlaubt, was die Lösung nicht verrät.
The so-called Übungsleitung will have an eye on this repository. But as long as the tests do not reveal the solution of the homework, this repository will tolerate them. To ensure the solution is not getting revealed, the tests should be Input/Output-Tests only.
Furthermore, there is no guarantee of the correctness of the tests. Neither the Übungsleitung nor any of the other tutors will contribute own tests. We (Johannes Stöhr, Georg Kohl, Erik Franz) will just make sure that there are no tests that reveal the solution. It is your own responsibility to validate the correctness and if necessary report bugs or even provide/contribute a fix for your fellow student.
correct:
// Test Area calculation
// Arrange
Rectangle r1 = new Rectangle(length: 4, width: 4)
// Act & Assert
assertEquals(16, r1.calculateArea());
wrong!:
// Test Area calculation
// Arrange
Rectangle r1 = new Rectangle(length: 4, width: 6)
// Act & Assert
// Calculate using length * width // <-- reveales the solution
assertEquals(4*6, r1.calculateArea()); // <-- reveales the solution
-
Clone this repository
git clone https://github.com/JohannesStoehr/gad23-tests.git
-
Check for updates
git pull
-
copy the
test
directory to the root of your repository (next tosrc
) and not inside your src folder./your-gad-project ├───src ├───test └───...
Or use the symlink instruction below.
-
make sure in the
build.gradle
filesourceSets
,test
anddependencies
look somewhat like that:sourceSets { main { java { srcDir 'src' } } test { java { srcDirs = ['test'] } } } test { useJUnitPlatform() } dependencies { testImplementation('org.junit.jupiter:junit-jupiter:5.9.0') }
-
Open the gradle tool window
-
Click reload
-
Run the tests via
tasks → verification → test
and check your mistakes -
Do not add the tests/modified build.gradle to your artemis git repository (it should already be in your .gitignore)
As this is a student-driven project please keep in mind that mistakes can happen. If you think a test is wrong, please feel free to open an Issue (it is easy!). To help fixing bugs, please add the following info to your Issue
:
-
Operating system
-
IDE (IntelIJ, Eclipse, …)
-
Where is the mistake / error
-
Citation of the homework instruction
Windows:
This has to be executed in the command line, run as administrator:
$ mklink /d \path\to\artemis-repository\test\gad \path\to\test-repository\aufgabe\test\gad
Linux/MacOS:
$ ln -s /path/to/test-repository/aufgabe/test/gad /path/to/artemis-repository/test/gad
-
Read our guidlines in our (CONTRIBUTIND.md)
-
Fork Repository (GitHub Documentation)
-
Add / edit tests under
<EXERCISE>/test/
-
Ensure no solution or homework-code is getting revealed
-
Commit and push to your fork repository
-
Open a Pull Request to this repository (GitHub Documentation)
-
Wait until another student reviewed the PR
-
Notify Johannes about a ready Pull Request and wait for the merge
-
Tests PGDP WS 22/23 (Testcases from first semester course might be a helpful guideline/inspiration)
-
Write Tests using JUnit 5
-
How to use Git
-
How to use GitHub
Feel free to contact us (Johannes Stöhr, Georg Kohl, Erik Franz) via Zulip, but consider using google beforehand.