Sikulix Screen parallel testing

Asked by Ana Vukovic

Hi,

I am usin sikulix on Mac version 2.0.6 and when I run one test, it is doing fine, but when I run in parallel, images are not recognized or clicked, but with no error. I tried with class ThreadLocal, but results are the same

 private static final ThreadLocal<Screen> threadScreen = new ThreadLocal<>();

    public void setDriver(Screen screen) {
        threadScreen.set(screen);
    }

    public static void initializeSikulix() throws MalformedURLException {
        Screen screen = new Screen();

        threadScreen.set(screen);

    }

    public static Screen getScreen() {
        return threadScreen.get();
    }

And usage in test:

 SikulixFactory.getScreen().doubleClick("/gaming/select.png", 10);

Can you help me to run this in parallel?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said (last edit ):
#1

Generally with SikuliX running SikuliX features in parallel does not make sense, because screen, mouse and keyboard are single-use resources and inside SikuliX things are not prepared for parallel use.

Nevertheless something like

new Screen().find("some-image.png")
should be possible to place inside a Runnable/Thread.

So I recommend to start as simple as posssible.

BTW: doubleClick("/gaming/select.png", 10)
the second parameter is a modifier value for the click action and not a wait time as you might think.

If you want to wait and click if success
wait("/gaming/select.png", 10).doubleClick()

Revision history for this message
Best RaiMan (raimund-hocke) said :
#2

.. and have a look at the observe feature, which has some built in single-use support with respect to the same Region object.

Revision history for this message
Ana Vukovic (anavuk) said :
#3

Thank you, I will have a look, but I use a lot clicking on image in tests, so I think I can't use that for parallel testing on one machine.

What about Selenium grid, each node to be one machine (one test)?

Revision history for this message
RaiMan (raimund-hocke) said :
#4

--- but I use a lot clicking on image in tests, so I think I can't use that for parallel testing on one machine
you have to serialize the clicking among all parallel tests - not a feature of SikuliX

Selenium: I have to leave you alone ;-) no experience and knowledge.

Revision history for this message
Ana Vukovic (anavuk) said :
#5

Thanks RaiMan, that solved my question.