[keycloak-dev] Testing with mocking libraries?

Pavel Drozd pdrozd at redhat.com
Fri Jun 1 04:33:01 EDT 2018


I don't like mocks for many reasons, but this PR seems to me reasonable. 
It's hard to setup and test the social IDPs in general. But if we allow 
using mocks I have same concern as Marek, I'm afraid that the mocks will 
be used everywhere.

If we will be able to limit mocks usage for specific areas like social 
logins, it's acceptable for me.

Pavel

Dne 31.5.2018 v 08:38 Marek Posolda napsal(a):
> Not sure. I am not strongly against it, but I afraid that if we
> introduce some mocks support, people (especially from community) will
> start to test with mocks everywhere and add them to all PRs (even to
> those which could be easily tested properly). Not sure if it's better
> alternative to skip automated test at all instead of test with mocks?
>
> But for this one, I guess we can likely extend our social test with an
> account from hosted domain and hence test it properly?
>
> Marek
>
>
> On 30/05/18 09:19, Stian Thorgersen wrote:
>> At the moment our testing strategy is only with functional or integration
>> level tests. Both with the full server up and running and primarily testing
>> through public APIs.
>>
>> Now here comes the question should we also allow testing through a mocking
>> library like Mockito?
>>
>> In general I'm against mocking libraries. At best you end up with something
>> that may work, but you're not guaranteed that it actually works. They also
>> have a very big maintenance cost when any changes are made to the codebase.
>>
>> However, take a look at https://github.com/keycloak/keycloak/pull/5215 for
>> example. It is a contribution to add support for the hd param to the Google
>> login. Not sure how else we could test this without a mocking library.
>> _______________________________________________
>> keycloak-dev mailing list
>> keycloak-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev



More information about the keycloak-dev mailing list