[keycloak-dev] Running unit tests with different model implementations

Marek Posolda mposolda at redhat.com
Mon Feb 10 15:45:16 EST 2014


Hi,

For improving testability, it would be nice if it's possible to execute 
unit tests with all available model implementations.

It seems that for testability of various model implementations, it may 
be good to move majority of unit test classes (like AdapterTest, 
ImportTest etc) from module "services" into "model/api" and then each 
model implementation will run all unit tests for particular model during 
it's own build. So building of module "model/jpa" will run all unit 
tests with JPA model and similarly building of "model/mongo" will run 
same set of tests for mongo module. This means that unit tests for all 
enabled models will be automatically executed during Keycloak build, 
which means that various model implementations won't be out of sync.

This would mean that some util classes used in unit tests will be moved 
from services to model/api as well because unit tests need them (For 
example RealmManager, ApplicationManager etc.)

Another possibility is to keep unit tests in "services" module and just 
add some dedicated profile for running tests with Mongo. So for example 
-Dkeycloak.model=mongo will run unit tests with Mongo model and 
-Dkeycloak.model=all will run unit tests with all available model 
implementations (so currently jpa and mongo).

What do you think?

Thanks,
Marek


More information about the keycloak-dev mailing list