ICFI / eagle

1 stars 4 forks source link

Invoke Unit Tests? #20

Closed jamiejackson closed 6 years ago

jamiejackson commented 6 years ago

I see some unit tests, but I'm not sure how to invoke them (either from an IDE or from the CLI).

In Maven projects, I'm used to running unit tests, but I'm brand new to gradle.

$ ./gradlew test

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9-rc-2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 2s
4 actionable tasks: 4 up-to-date
$ tree src/test/
src/test/
└── java
    └── eagle
        ├── ApplicationTest.java
        └── tests
            └── RESTControllerTest.java
justin-wilcoxen-reisys commented 6 years ago

Invoking on gradle is similar to Maven. You need to build app first, then run tests. Build script is not wired to run both tasks together. Kept the build script simple for now.

1) ./gradlew clean build 2) ./gradlew test

Output should is best viewed in Test Report produced by gradle plugin which is built in the build directory.

eagle/build/reports/tests/test/index.html

justin-wilcoxen-reisys commented 6 years ago

I am lacking documentation, which is on my list to bolster. But, frameworking and architecture components gave way to that so far.

jamiejackson commented 6 years ago

Got it. (I'd thought I'd be seeing something in the console.) ATM, it seems to be outputting XML results (in a slightly different output dir), but we should be able to consume those in Jenkins.

$ tree build/test-results/
build/test-results/
└── test
    ├── TEST-eagle.ApplicationTest.xml
    ├── TEST-eagle.tests.RESTControllerTest.xml
    └── binary
        ├── output.bin
        ├── output.bin.idx
        └── results.bin
jamiejackson commented 6 years ago

Here we go:

$ tree build/reports/
build/reports/
└── tests
    └── test
        ├── classes
        │   ├── eagle.ApplicationTest.html
        │   └── eagle.tests.RESTControllerTest.html
        ├── css
        │   ├── base-style.css
        │   └── style.css
        ├── index.html
        ├── js
        │   └── report.js
        └── packages
            ├── eagle.html
            └── eagle.tests.html