Skip to content

Unify Testing client and RunOnServer APIs for smoother test migration#48363

Draft
vaceksimon wants to merge 5 commits intokeycloak:mainfrom
vaceksimon:48319-Testing-client-and-RunOnServer
Draft

Unify Testing client and RunOnServer APIs for smoother test migration#48363
vaceksimon wants to merge 5 commits intokeycloak:mainfrom
vaceksimon:48319-Testing-client-and-RunOnServer

Conversation

@vaceksimon
Copy link
Copy Markdown
Contributor

Closes #48319

Copy link
Copy Markdown
Contributor

@stianst stianst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified and made cleaner.

For example if you have RunOnServerUtils has something like:

    public static RunOnServer printRealm(String realm) {
        return session -> System.out.println(session.realms().getRealmByName(realm).getDisplayName());
    }

Then you can use it with runOnServer.run(RunOnServerUtils.printRealm("asdfsadf")), which removes the need to have the session -> part and also passing session to the method.

You should probably also call it RunOnServerHelpers instead of Utils as that's what we have used for those things in the past.

Finally, this shouldn't be part of the test-framework as these are very internal things, that we don't want to expose. So just add it to the tests/base.

@stianst
Copy link
Copy Markdown
Contributor

stianst commented Apr 22, 2026

@vaceksimon should be in /tests/utils-shared I guess so we can refactor the old testsuite to use these instead of testingResource?

@vaceksimon
Copy link
Copy Markdown
Contributor Author

Well, right now I have two versions of RunOnServerHelpers (or RunOnServerUtils) because the old test suite still calls the testing resource, and the new one uses our run on server. If you're thinking about having a single helper class, I don't know how it could still be used by both test suites.

Besides, I don't think we get more benefit from moving it to /tests/utils-shared as long as the two versions have the same package name, right? @stianst

@vaceksimon
Copy link
Copy Markdown
Contributor Author

@stianst or maybe this new helper should be merged with the already existing RunHelpers

Signed-off-by: Simon Vacek <[email protected]>

# Conflicts:
#	testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/LoginTest.java
Signed-off-by: Simon Vacek <[email protected]>
@vaceksimon vaceksimon force-pushed the 48319-Testing-client-and-RunOnServer branch from 43cf6e4 to 57250cd Compare April 24, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify Testing client and RunOnServer APIs for smoother test migration

2 participants