1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-06 13:56:34 +02:00

provide tasks to unit test, and describe them

gradle does not take the excludeTags and includeTags parameters
on the command line with gradle-6.8.3. provide tasks for it,
and describe better how to run particular unit tests.
This commit is contained in:
soloturn
2021-03-28 10:36:30 +02:00
parent ca1c78c491
commit 7f1ae26d9b
2 changed files with 41 additions and 23 deletions

View File

@@ -79,40 +79,40 @@ If you're a developer, you can add your own Ripper by following the wiki guide:
# Compiling & Building # Compiling & Building
The project uses [Gradle](https://gradle.org) or [Maven](http://maven.apache.org/). The project uses [Gradle](https://gradle.org). To build the .jar file,
Therefor both commands are given. To build the .jar file, navigate to the root navigate to the root project directory and run at least the test you
project directory and run: change, e.g. Xhamster. test execution can also excluded completely:
```bash ```bash
mvn clean compile assembly:single ./gradlew clean build testAll --tests XhamsterRipperTest.testXhamster2Album
mvn -B package assembly:single -Dmaven.test.skip=true
```
```bash
./gradlew clean build
./gradlew clean build -x test --warning-mode all ./gradlew clean build -x test --warning-mode all
``` ```
This will include all dependencies in the JAR. One can skip executing the tests The generated JAR (java archive) in build/libs will include all
as well. dependencies.
# Running Tests # Running Tests
Tests can be marked as beeing slow, or flaky. Default is to run all but the flaky tests. Slow tests can be excluded to Tests can be tagged as beeing slow, or flaky. The gradle build reacts to
run. slow and flaky tests can be run on its own. After building you can run tests, quoting might be necessary depending the following combinations of tags:
on your shell:
```bash - default is to run all tests without tag.
mvn test - testAll runs all tests.
mvn test -DexcludedGroups= -Dgroups=flaky,slow - testFlaky runs tests with tag "flaky".
mvn test '-Dgroups=!slow' - testSlow runs tests with tag "slow".
``` - tests can be run by test class, or single test. Use "testAll" so it does
not matter if a test is tagged or not.
```bash ```bash
./gradlew test ./gradlew test
./gradlew test -DexcludeTags= -DincludeTags=flaky,slow ./gradlew testAll
./gradlew test '-DincludeTags=!slow' ./gradlew testFlaky
./gradlew testSlow
./gradlew testAll --tests XhamsterRipperTest
./gradlew testAll --tests XhamsterRipperTest.testXhamster2Album
``` ```
Please note that some tests may fail as sites change and our rippers become out of date. Please note that some tests may fail as sites change and our rippers
Start by building and testing a released version of RipMe become out of date. Start by building and testing a released version
and then ensure that any changes you make do not cause more tests to break. of RipMe and then ensure that any changes you make do not cause more
tests to break.

View File

@@ -85,6 +85,24 @@ tasks.register<Test>("testAll") {
} }
} }
tasks.register<Test>("testFlaky") {
useJUnitPlatform {
includeTags("flaky")
}
}
tasks.register<Test>("testSlow") {
useJUnitPlatform {
includeTags("slow")
}
}
tasks.register<Test>("testTagged") {
useJUnitPlatform {
includeTags("any()")
}
}
// make all archive tasks in the build reproducible // make all archive tasks in the build reproducible
tasks.withType<AbstractArchiveTask>().configureEach { tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false isPreserveFileTimestamps = false