[keycloak-dev] Testing with mocking libraries?

Hynek Mlnarik hmlnarik at redhat.com
Wed Jun 6 04:03:15 EDT 2018


To answer the original question whether to mock or not to mock, I wouldn't
object allowing those in unit tests (which we have not that many though
until now there's no need to them and I hope we can preserve this state).
I'd rather not introduce those in integration tests because of maintenance
costs.

The biggest issue I see with mocks is that one needs to be extra careful to
return exactly what's expected from the specification/counterparty.
Since social
providers  can change without prior notice, our mocked IdPs might give us
false impression that we're testing them. Furthermore, such mocks would be
rather complex, and would require non-trivial maintenance. I'm hence biased
against mock IdPs and prefer the tests with real IdPs as mentioned by Marek.


On Mon, Jun 4, 2018 at 11:22 AM, Marek Posolda <mposolda at redhat.com> wrote:

> Dne 1.6.2018 v 14:48 Bill Burke napsal(a):
> > On Fri, Jun 1, 2018 at 5:18 AM, Marek Posolda <mposolda at redhat.com>
> wrote:
> >> For IDP, I am not sure how would Mocked IDP help? We already have lots
> of
> >> test coverage for Identity brokering for OIDC and SAML. The social
> providers
> >> usually implements OAuth/OIDC and there are just small differences
> between
> >> them. But those small differences and the fact that social providers
> are out
> >> of our control, is exactly the reason why we need to test with real
> >> providers instead of mocks IMO.
> >>
> > IDP mocks are not a replacement for real testing.  Just something that
> > would run in public CI, that way at least there's something to catch
> > issues like when/if brokering gets refactored again.
> AFAIK the longer-term plan is to run social tests on every PR, to catch
> regressions by testing with real social providers. So maybe it's better
> to rather wait until we have that rather then introduce mocks now?
>
> Also anyone from community should be able to run social tests based on
> our README. The important is, that someone could run it just for single
> provider, which he is interested in (EG. Google for this PR) and is not
> required to create the account+application in all social providers,
> which we support. But I hope the social tests already support this now.
>
> Marek
> >
> > Bill
>
>
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>



-- 

--Hynek


More information about the keycloak-dev mailing list