Hello,

this post is may be interesting for CAS contributors...

I try to run CAS's JUnit-based unit tests from command line, i. e. via 
Gradle - see 
https://apereo.github.io/cas/development/developer/Test-Process.html#unit--integration-testing.
 
I've run into the following problems though that are not present in the 
6.2.x branch, so it seems like a novelty in the 6.3.x and master branches.

Note that I'm intentionally leaving just the necessary command line 
parameters in the examples below in order to keep it short.

1) *Running tests just from one module is not possible*

This is not documented, yet it is working in 6.2.x. For example:

$ ./gradlew :core:cas-server-core-authentication 
{cleanTest,testSimple} --info

Unexpected result:

...
> Task :core:cas-server-core-authentication:testSimple SKIPPED
Skipping task ':core:cas-server-core-authentication:testSimple' as task 
onlyIf is false.
:core:cas-server-core-authentication:testSimple (Thread[Execution worker 
for ':',5,main]) completed. Took 0.0 secs.

2) *Running a single test is not possible*

For example (note that the `--category` switch seems to be mandatory, there 
is probably some technical reason behind always filtering tests by their 
`@Tag` annotation):

$ ./testcas.sh --category simple --test 
org.apereo.cas.authentication.handler.ConvertCasePrincipalNameTransformerTests

... which runs:

$ ./gradlew cleanTest testSimple --tests 
"org.apereo.cas.authentication.handler.ConvertCasePrincipalNameTransformerTests"

Unexpected result:

> Task :api:cas-server-core-api-configuration-model:testSimple FAILED
Started running test suite [Gradle Test Run 
:api:cas-server-core-api-configuration-model:testSimple] @ Sat Apr 03 
11:31:45 CEST 2021

Results for test suite [Gradle Test Run 
:api:cas-server-core-api-configuration-model:testSimple]: SUCCESS @ Sat Apr 
03 11:31:45 CEST 2021
(0 tests, 0 successes, 0 failures, 0 skipped)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task 
':api:cas-server-core-api-configuration-model:testSimple'.

---

I tried to comment out various suspicious parts within the 
"cas/gradle/tests.gradle" file and also passing various switches to the 
Gradle build, but nothing worked so far.

So can anybody help with this? Until then, launching just selected tests 
from within *IDEA*, via its JUnits runner, seems to be the working way, and 
maybe that this could also be *recommended* for launching tests in an 
ad-hoc style in the CAS docs?

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/cfdcfdbe-636d-47b5-9e50-f408e32a45e1n%40apereo.org.

Reply via email to