[2.0.4] Java API: Screen class: maven surefire plugin exception running the test from TeamCity

Bug #1962734 reported by Arsen Papoyan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Incomplete
Undecided
RaiMan

Bug Description

When I run a test with Sikuli Screen class on a local machine or from a local machine into a remote server, the test runs without error, but when I run the same test from CI (TeamCity), I get this error:

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project myProject: There are test failures.
[ERROR]
[ERROR] Please refer to /root/work/myProject/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com.bme.test.SikuliExampleTest
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR]
[ERROR] Cannot instantiate class com.bme.test.SikuliExampleTest
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:733)
...

Other tests run from TeamCity also work without errors.
POM:
<plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-surefire-plugin</artifactId>
     <version>3.0.0-M5</version>
 </plugin>

   <dependency>
        <groupId>com.sikulix</groupId>
        <artifactId>sikulixapi</artifactId>
        <version>2.0.4</version>
    </dependency>

RaiMan (raimund-hocke)
summary: - By using the Sikuli Screen class, the maven surefire plugin exception is
- thrown when running the test from TeamCity
+ [2.0.4] Java API: Screen class: maven surefire plugin exception running
+ the test from TeamCity
Changed in sikuli:
assignee: nobody → RaiMan (raimund-hocke)
status: New → Incomplete
Revision history for this message
RaiMan (raimund-hocke) wrote :

There are no SikuliX related informations, that could help to evaluate the cause.

BTW: 2.0.4 is no longer supported.

Revision history for this message
Arsen Papoyan (arsen-papoyan) wrote :

What exact information do you need?

I have a simple test in which I use the Screen and Pattern classes from SikuliX.
When running the test on local or from local to remote machine everything works fine, but in case of running the same test from CI(TeamCity), the error (above mentioned) is thrown when initializing the test class.
When I remove just the Screen class, the test runs without errors in all environments.

Revision history for this message
RaiMan (raimund-hocke) wrote :

If the Screen class makes problems, then there must be messages or exceptions. Make sure they are visible.

--- When I remove just the Screen class ...
Removing the class means, that no SikuliX features are run, that might crash.

Most probably in your TeamCity environment there is no accessible real screen or at least a fake screen, that is accepted as non-headless.
SikuliX needs access to a real screen.
If the Screen class is initialised in a screenless environment, an exception is thrown and no features work.

Revision history for this message
Arsen Papoyan (arsen-papoyan) wrote :

I have real screen access via VNC to my remote machine and when running a test (with the Screen class) from my local machine to the remote machine (which has real screen access) everything is fine but running from TeamCity in which case also there is a real screen I get that error.

Revision history for this message
RaiMan (raimund-hocke) wrote :

I believe you ;-) since you seem to work on a real screen, where you do/see all your stuff.

... but this does not help.

In the TeamCity environment you have to take care, that you get messages/exceptions down under from SikuliX.

Do a step by step try and error with basic features and create messages/exceptions yourself.

More I cannot do for you, due to lack of knowledge/experience with TeamCity.

Revision history for this message
RaiMan (raimund-hocke) wrote :

--- Cannot instantiate class com.bme.test.SikuliExampleTest

Such errors usually are created, when imports do not work or some static stuff cannot be processed.

So take care, that your class path in the TeamCity context has the sikulixapi jar and all dependencies.

description: updated
Revision history for this message
Arsen Papoyan (arsen-papoyan) wrote :

Thank you for your reply and suggestion.
I have no idea what "class path in the TeamCity context has the sikulixapi jar and all dependencies" means.
I have all dependencies in my project and TeamCity linked to the VersionControl gets the changes and builds the test.
All my changes and tests work fine, except for the test that includes the Screen class.
I'm trying my best to find a solution to the problem but to no avail.
I found the same error posted but it was related to the maven surefire plugin and jdk version on the Docker platform but I don't use Docker I just use Selenium Grid in OS.

Revision history for this message
RaiMan (raimund-hocke) wrote :

I see 2 possibilities:

- in your crashing test with the Screen class, before Screen is touched check the class path content

- run the crashing test in Debug mode (if possible ???) to find out, where it crashes

Another option is, to try with the fat SikuliX IDE jar, that contains all dependencies including SikuliX API.

Hope it helps

Revision history for this message
RaiMan (raimund-hocke) wrote :

BTW: what system context is used in the TeamCity environment (linux, windows, Mac, ...)?

Revision history for this message
Arsen Papoyan (arsen-papoyan) wrote :

I have three OS (Mac, Windows, Linux) set up on a remote machine and I set them all in TeamCity Environment Variables using a Groovy script.
And on all OSs, the Screen class test fails.

Revision history for this message
RaiMan (raimund-hocke) wrote :

ok, thanks.

If you want to have more support beyond comment #8, then you have to try with the 2.0.6 snapshot.

There I can actually try to find out, what might be the cause, if it does the same as 2.0.4.

Revision history for this message
Arsen Papoyan (arsen-papoyan) wrote :

ok, thank you too.
will try and let you know.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.