Cross-Browser and Cross-Platform Scripting
An Eggplant Functional (EPF) script can typically be used across all browsers on all underlying operating systems with little or no modification. This is because the script simply describes the user workflow, which is always the same.
The vast majority of reference images can also be reused across all browsers (for example, across Chrome, Firefox, Safari, Internet Explorer, and Opera) on all operating systems (for example, across Windows, Mac, and Linux). But there are two situations in which reference images may not be re-usable in all environments:
- Different browsers render fonts differently, so text search (rather than image search) should be used as described below.
- The actual browser controls (for example, the refresh button) are different for each browser. So these specific reference images are different for each browser.
To facilitate cross-browser testing, Eggplant Functional supports integration with Sauce Labs. Sauce Labs makes it easy to test a multitude of Browser and OS combinations. See Connecting to Sauce Labs Devices and Browsers for more information.
Best Practices for Cross-Browser and Cross-Platform Scripting
This document presents best practices for efficient cross-browser scripting. In summary:
- Use the Tolerant of Background default search type for images.
- Use OCR text searches, rather than image searches, for interacting with text.
- Separate out core code from OS-specific code for easier test creation.
- Run an environment setup script at the start of every test.
- Run your test from a primary suite.
- Create a naming convention for SUTs.
- Use keyboard commands wherever possible to reduce the need for image capture.