Entering text with no dependency on current keyboard layout
04:33 19 Nov 2025

If a GUI test must involve entering text in a text field, a convenient shortcut is robot.enterText(..) (available in both FEST and its fork, AssertJ Swing).

I was under the impression the utility is smart enough to switch the keyboard layout if it doesn't match the text. Actually, it is not: all this time such a switch was done by my local utility application, Punto Switcher.

It means such tests are dependent on the keyboard layout which is unacceptable.

I know I can set a so-called "input locale" for any component which would in effect change the layout (component.getInputContext().selectInputMethod(..)). It would require explicitly setting the input locale in each such test before invoking robot.enterText(..). However, I was wondering whether I could do it a better way.

What is the best way to address this?

java testing assertj-swing