Can an image be swapped out (basically overwritten) and have the system not break?

Asked by Shannon on 2017-02-21

Can an image be swapped out (basically overwritten) and have the system not break? The test may fail if say some x,y position needs updating for the new image, but we'd like to be able to re-use an image across tests, swap it out, then do a find/replace in files via notepad++ to update the tests rather than have to update each test individually.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2017-02-23
Last query:
2017-02-23
Last reply:
2017-02-23
RaiMan (raimund-hocke) said : #1

Be aware:
what you are scripting is Python. So just look into the .py file inside the Sikuli folder and you can see and decide how to solve your problem,

Shannon (shannon13) said : #2

Apologies here, I wasn't entirely clear in my question. Let me see if I can fix that.

We want to create a folder that contains all the images referenced by the tests we create. These images will be named appropriately so they can be easily identified by anyone using them. The name we give the image will be what is used in the test, rather than the auto-generated number.

Say something changed in the UI and we need to take new images. We want to be able to just save the new image in the image folder under the name we originally gave the image. This would save us from having to change each individual test that references the image.

in theory, this should work (right?) I would just like to confirm.

Best RaiMan (raimund-hocke) said : #3

This works, if you do that manually between testruns.

If you use the IDE (for more professional cases like you seem to do, I always recommend, to run production scripts from commandline), the scripts referencing the images have to be closed and opened again. In doubt you have to restart the IDE.

Shannon (shannon13) said : #4

Thanks RaiMan, that solved my question.