[1.0] CUIT Integration - running Sikuli scripts in subprocesses

Asked by Gregor Haider

Hello,

I'm up to generate a automated test suite for our project C#/TFS12. We are using WPF and third party controls.
Unfortunately these third party controls does not support Coded UI Tests (CUIT) and get not properly recognized
by the Coded UI Test Builder.

This brought me to Sikuli. I have the idea to build normal Coded UI Tests and fake the steps which are not supported
be running a script with the corresponding step in Sikuli.

I had no problems design the desired behavior in Sikuli, and I made a prototype calling this script from C# program,
which wasn't a problem either. But when I try to run this script during the playback of the CUIT, the Sikuli sequence
fails. Native library can not be loaded: VisionProxy.

I'm a bit confused because the same process call works very well in the test app, but fails in the test playback.

Thanks in advance for every hint you could give.

Best regards,
Gregor

Question information

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

The Sikuli installation contains a libs folder containing the needed native libraries.

When facing problems with native libraries at runtime in other environments than the normal Sikuli standalone usage, you have to take care:

- that Sikuli knows where the libs folder is: use environment variable SIKULI_HOME (version 1.0.0 SIKULIX_HOME) and set it to
set SIKULI_HOME=path-to-the-sikuli-folder\ // for RC3 - trailing \ mandatory
set SIKULIX_HOME=path-to-the-sikuli-folder // for version 1.0.0, no trailing \ needed

- have the libs folder in the system path:
set PATH=%SIKULI_HOME%libs;%PATH% //RC3
set PATH=%SIKULIX_HOME%\libs;%PATH% //version 1.0.0

path-to-the-sikuli-folder is the absolute path to the folder containing sikuli-script.jar and the libs folder.

The service update 1.0.1 (end July) will have more automatic options and be more robust against these problems.

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

BTW: how do you trigger the script run from inside your framework?

Revision history for this message
Gregor Haider (g-haider) said :
#3

Hi,

thanks for the very fast answer. I checked that their exist system variables for both, SIKULIX_HOME and PATH.

I call the script by creating a process like:

Process process = new Process();
ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.FileName = @"D:\Sikuli\ds.bat";
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();

where the ds.bat capsulates the navigation to the correct folder followed by:
sikuli-script -r path-to-the-test\the-test.sikuli

Best regards,
Gregor

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

Then the process environment does not copy the system/user environment down to the process client.

Just put the 2 settings into your ds.bat.

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

@ the request list ;-)
I think we should have a "script-running-server", that is correctly setup and waiting in the background for script run requests posted by some sort of clients (e.g. using HTTP or XML-RPC).

Revision history for this message
Gregor Haider (g-haider) said :
#6

Hi RaiMan,

thank you very much for your very professional assist this morning.
I'm overall quite impressed by the capabilities of Sikuli.

I solved the problem by not calling the sikuli-script command but saved the
test itself to an executeable (*.skl) and run this from the process.

Thanks again for you very fast response this thursday morning.

Best regards,
Gregor

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

Uuups, now I am somewhat surprised.

Since you said to use SIKULIX_HOME, I thought you where using version 1.0.0, but this cannot run .skl this way, because it does not have a registered executable behind, like RC3 has.

So pls.: what Sikuli exactly are you using and where is this stuff located?
what Windows?
what Java?

I have not yet decided about the future support for some "double-clickable" sikuli scripts (like .skl with RC3).

Revision history for this message
Gregor Haider (g-haider) said :
#8

Hi,

I was totally new to Sikuli yesterday morning. So I downloaded 1.0.0, which is not able to playback *.skl this way,
as I can confirm.

Yesterday afternoon I decided to install RC3. And this morning I realized that the Icon of a skl-file, I created
yesterday, changed. So i double-clicked it an voila. I manipulated the test process call to run the skl-file and
in combination with some minor changes in the CUIT it works very well.
So actually RC3 solved the problem. And please contine to support "double-clickable" sikuli scripts :-)

So in the end I do coded UI testing using Visual Studio and Microsoft Test Manager, and fake that steps
Coded UI Test Builder isn't able to perform on the third party controls.

Best regards,
Gregor

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

Thanks. all the best.

Revision history for this message
eetawil (eetawil) said :
#10

Hello Gregor,

I'm also faced with the same situation as yourself CodedUI on some application that is not built by us. Can you please send me an example of that sikuli file (.skl) that you used to execute from a C# process? I understand that yo uhave to setup some environment variables...

Please note that I didn't even try sikuli yet, I was browsing the web to try and find a solution and I stumbled on your post. I was aware of the existance of sikuli but we where asked to use coded ui. And now based on your post I think I can have the best of both words!

I will talk to my team tomorrow about this finding and will for sure download and try sikuli, your .skl would greatly help us.

Thanks in advance.

Revision history for this message
Gregor Haider (g-haider) said :
#11

Hi,

sorry I don't have a proper example here right now.
But you just can download Sikuli IDE, and record some "steps"
(like click on that place on the screen or enter that text in this
text box...) and save it a script, as far as I remember, that was only
possible with previous versions of Sikuli.

We had the problem that our third level UI components were not
Coded UI testable, so I recorded a normal CUIT and fake that steps
which were not able by Sikuli scripts.

Just start a process, which runs a Sikuli script instead of the step of
your CUIT.

I hope that helps.

Kind Regards,
Gregor

-----Ursprüngliche Nachricht-----
Von: <email address hidden> [mailto:<email address hidden>] Im Auftrag von eetawil
Gesendet: Mittwoch, 12. Februar 2014 03:36
An: Gregor Haider
Betreff: Re: [Question #232233]: [1.0] CUIT Integration - running Sikuli scripts in subprocesses

Your question #232233 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/232233

eetawil posted a new comment:
Hello Gregor,

I'm also faced with the same situation as yourself CodedUI on some application that is not built by us. Can you please send me an example of that sikuli file (.skl) that you used to execute from a C# process? I understand that yo uhave to setup some environment variables...

Please note that I didn't even try sikuli yet, I was browsing the web to try and find a solution and I stumbled on your post. I was aware of the existance of sikuli but we where asked to use coded ui. And now based on your post I think I can have the best of both words!

I will talk to my team tomorrow about this finding and will for sure download and try sikuli, your .skl would greatly help us.

Thanks in advance.

--
You received this question notification because you asked the question.

Revision history for this message
eetawil (eetawil) said :
#12

Thanks Gregor,

Last question: Did that work out well for , the sikuli tool? Do you recommend it or do you think there is a better way? Any lesson learned comments on that sikuli tool?

Revision history for this message
Gregor Haider (g-haider) said :
#13

Hi,

Well, it is more work to do than normal CUITs, but well it worked.
I created the executable 'Sikuli's' with version RC3, maybe you find it
Somewhere on the net.

But although it is more work compared to the rather comfortable
CUIT Recorder of Visual Studio / Test Manager, it works reliable
and especially for my problem, I haven't found any other solution...

The actually hardest part is to determine the correct position in the
CUIT source code to run the script as described above.

Something like:
Process process = new Process();
ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.FileName = @"{PLACE ABSOLUTE PATH TO *.SKL-FILE HERE}";
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();

Best Regards,
Gregor