[keycloak-user] Integration Tests

Gabriel Trisca gtrisca at cignifi.com
Tue Apr 4 19:15:11 EDT 2017


Hi Marek,

Thanks for your response. If I understood correctly, those links explain
how to run Keycloak's testsuit (if I modified any of the Keycloak source).
What I'm looking for is something that I can run from my own code.

Doing some more googling, I found this thread from October:
http://lists.jboss.org/pipermail/keycloak-user/2016-October/008031.html
that mentions exactly what I'm looking for: a way for me to use the
KeycloakServer class in my tests to programatically start and configure the
server, instead of using a full "distribution" version of Keycloak.

Are there any plans to make KeycloakServer available for these types of
scenarios?

Thanks in advance!



On Tue, Apr 4, 2017 at 3:48 PM, Marek Posolda <mposolda at redhat.com> wrote:

> Hi,
>
> there is some docs here https://github.com/keycloak/ke
> ycloak/blob/master/misc/Testsuite.md and here
> https://github.com/keycloak/keycloak/blob/master/misc/HackingOnKeycloak.md
>
> Marek
>
> On 04/04/17 19:17, Gabriel Trisca wrote:
>
>> Hi all,
>>
>> What is the best way to run integration tests with Keycloak? I would like
>> to have an embedded Keycloak server that can be brought up as a @ClassRule
>> or something along those lines, and then I can validate that different
>> users have or don't have access to resources/scopes.
>>
>> I found that there is a testsuite path in Git that contains many useful
>> classes, like a KeycloakServer that can be initialized with a realm
>> exported as JSON, but this module (keycloak-testsuite-integration) is not
>> deployed to Maven central.
>>
>> I tried to clone the repository and install that artifact locally, but I
>> face different errors that hint at mismatched versions in dependencies:
>>
>> Caused by: java.lang.NoSuchMethodError:
>> org.hibernate.engine.spi.SessionFactoryImplementor.getProper
>> ties()Ljava/util/Properties;
>> at
>> org.hibernate.jpa.internal.EntityManagerFactoryImpl.<init>(E
>> ntityManagerFactoryImpl.java:124)
>> at
>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderI
>> mpl.build(EntityManagerFactoryBuilderImpl.java:890)
>> at
>> org.keycloak.connections.jpa.util.JpaUtils.createEntityManag
>> erFactory(JpaUtils.java:63)
>> ...
>>
>> Thanks in advance.
>>
>>
>


-- 
*Gabriel Trisca, Software Developer*
Cignifi | 101 Main Street, 14th Floor, Cambridge, MA 02142  USA
P: +1 857-209-2685 • M: +1 301-433-2221 | www.cignifi.com


More information about the keycloak-user mailing list