eggPlant is an increasingly popular testing automation tool, which aims to approach testing the same way as a customer uses the software. It brings in a level of intuition and insight to testing to ensure the final product works like the customer wants it to work. In other words eggPlant is aiming to replicate human behavior. This results in software which is easier to use, has better quality, and higher customer satisfaction.
In this blog I will explain eggPlant and provide tips on how to get started.
Understanding the eggPlant tool
The eggPlant tool automates the workflow of real users through the application GUI, and performs tests in a two systems model.
The first system is where eggPlant is running and the second is where the system under test (SUT) is running, and the first machine controls the second through VNC/RDP technology. The reason for this is because automation tools can use image-based or object-based approaches, and eggPlant uses an image-based approach to identify and interact with SUT GUI elements.
eggPlant doesn’t care about the technology which was used to develop the application or the platform where the application is installed. This is because it uses image search and optical character recognition (OCR) to look for elements on the screen of the SUT. As long as there is a VNC server available for that platform, it means that the scripting is the same across any technology or platform combination.
How to Script with eggPlant
One way to come up with a script in eggPlant is via a “Turbo capture session”, where the entire session of our test case can be recorded and later converted to a script. Turbo capture session records all our actions and screenshots and once that the session is recorded we need to turn it into an eggPlant functional script. For that we need to adjust the capture area of every image recorded, making sure to exclude any part of the UI that doesn’t matter to our test. In addition, we need to name all the images according to a naming convention, the search type to image, or text (OCR). We also have the possibility to set a wait time to give to eggPlant extra time to find the image before the script times out. Once the script is generated, I recommend running it a couple of times in order to verify it works as you expect.
A second way to come up with an eggPlant script is manually. For this you capture all the images that your workflows involve, along with a command. It involves creating a set of image collections to later take the screenshots and assign them. With this approach you can create as many image collections as different devices, and you can run all of them with the same script.
Use modularization and parameterization to make your code more scalable and efficient
With modularization we can make our code more scalable and efficient. To help with this, eggPlant has created “Handlers”. Handlers can be scripts, commands or functions.
Script handlers can either work returning a value, or not return any value. So to create a new script handler you just need to select the piece of code that can be reused and select the option “Extract new script” and this will create a separate script that can be called from any part of the original script or even another script. Mixing this with parameterization, we allow handlers to work with parameters that make our code more reusable.
Understanding Optical Character Recognition (OCR) to read text
OCR, or Optical Character Recognition, is a key part of eggPlant Functional, and is an interpretative algorithm that examines all the pixels in the search area, to try and figure out if the pixel arrangements look like any known character. eggPlant puts this simply, saying OCR allows it to “read text off of the screen of your system”. OCR uses a dictionary to help interpret the shape of the pixel arrangements.
When to use OCR
You should use OCR when:
In other situations you’ll find that you have the option to use an OCR or an image to interact with particular text elements. Image maintenance could end up being quite high in situations where you are automating across multiple devices or browsers or operating systems. Generally OCR searches require less maintenance than image searches – this is because OCR searches don’t consider font size, typeface, color etc, while image searches necessarily enforce these characteristics.
What are your top tips for using eggPlant? Leave a comment below.
*Belatrix is a partner of TestPlant, the maker of the eggPlant range of software testing tools. Find out more about our testing services here.
July 08 / 2020
April 23 / 2020
As we gradually get used to our new COVID-19 reality, daily life from just a few weeks ago now feels like a lifetime away. For businesses this has created,...Read post