Forum Discussion
Philip_Baird
11 years agoCommunity Expert
Hi, just as a matter of interest, I thought I would share an approach we used based on the Selenium Page Object, where a single Class is used to model and control access to a Web Page under test, to provide access to UI Screenss under test in our JScript Script Units.
This approach mitigates, to an extent, the issue of having to maintain multiple Scripts when changing an Alias by minimising the points in code where an Alias is referenced.
1. A model for each Screen in the application under test is created as a JScript prototype.
2. Access to each control is controlled by fields and functions defined as part of the JScript prototype, this includes references to Aliases.
3. Then, if a test script needs to drive a Screen, it creates an instance of the JScript prototype and drives the screen via that instance, this provides the following benefits:
i. A level of control over how controls on a Screen can be accessed
ii. Aliases are only referenced ONCE in the entire code base
This means, if an Alias is changed, there is only a single point in the code base, the JScript prototype, that needs to be changed.
As long as they use the JScript prototypes, the Test Scripts themselves will not require any changes.
If they do not use the JScript prototypes, well, then the developer gets a severe rap over the knuckles and a support to ticket to change the code so they do ;)
Regards,
Phil Baird
This approach mitigates, to an extent, the issue of having to maintain multiple Scripts when changing an Alias by minimising the points in code where an Alias is referenced.
1. A model for each Screen in the application under test is created as a JScript prototype.
2. Access to each control is controlled by fields and functions defined as part of the JScript prototype, this includes references to Aliases.
3. Then, if a test script needs to drive a Screen, it creates an instance of the JScript prototype and drives the screen via that instance, this provides the following benefits:
i. A level of control over how controls on a Screen can be accessed
ii. Aliases are only referenced ONCE in the entire code base
This means, if an Alias is changed, there is only a single point in the code base, the JScript prototype, that needs to be changed.
As long as they use the JScript prototypes, the Test Scripts themselves will not require any changes.
If they do not use the JScript prototypes, well, then the developer gets a severe rap over the knuckles and a support to ticket to change the code so they do ;)
Regards,
Phil Baird
Related Content
- 12 years ago
- 13 years ago
- 5 years ago
- 2 years ago
Recent Discussions
- 15 hours ago
- 15 hours ago