Is there any work around ?

Asked by aravind

I am using Sikulix for UI testing, the problem is that when ever there are changes in UI I need to replace all the images which got changed using the IDE and I need to again describe the actions ( accuracy, click position) which is becoming a sort of overhead in my case. Is there any work around by which I can simply replace the new UI images in the project folder with the same old name ( It wont work directly as the new coordinates might be different + the new image should be of same resolution that of older one)

PS: I have completely understood that sikuli works at pixel level, but still curious to find out if any one has found a work around.

Question information

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

To manage different image Sets:
Assign the imagefilenames to variables with a strict naming convention in a separate section of your script or imported scripts/modules and then use the variables in your click...whatever actions. So you have only one place where you need to change things. Use the imagepath feature to select the right image set at runtime.

Revision history for this message
Roman Podolyan (podolyan-roman) said :
#3

Some time ago I was challenged to demo that I can run one and the same code for two implementations of the app, Android and iOS (close business logic but different dimensions and visualizations). My solution to the challenge (worked):

- I created a special class appdata , which holds all data related to particular app
-- inside the appdata class there are dictionary variables which are initialized with pairs "image_keyword":"image_disk_name"

Example A:
______
class appdata_ipad:

    def __init__(self, wait_int = 1.7):

        self.main_reg_defw = 570
        self.main_reg_defh = 736

         self.keys_img = {"backspace": "ipad_keyboard_backspace.png", "1": "ipad_keyboard_1.png", "2": "ipad_keyboard_2.png"}
______

-- class doing the automation gets this or that concrete appdata class as a parameter.

-- the code for the automation works not even with variables, but with keys to some appdata dictionary.

Example B:
______
                self.try_click(self.appdata.keys_img['1'])
                self.try_click(self.appdata.keys_img['2'])
______

Python dictionaries can hold various objects, you can include images with offsets too (I did). The calling strings look a bit cumbersome, but with this approach I have all images in one place, and had one code running on completely different apps for different platforms.

Hope that helps.

Revision history for this message
TestMechanic (ndinev) said :
#4

You may not want to do UI automation if UI design is not finished. It is rule of thumb.

Can you help with this problem?

Provide an answer of your own, or ask aravind for more information if necessary.

To post a message you must log in.