Welcome to the first lesson about desktop automation in Leaptest.
Desktop automation covers all applications running on a windows platform like Word and Outlook, and it also covers applications build on Microsoft and Java and many other technologies. It could be your CRM or Order handling system or any other front office or back office application.
In this video we will introduce the basics of Leaptest and show you some examples of how to automate a desktop application. The first automation case looks like this:
(Automation case runs)
When we run the case, the Leaptest demo application is opening and we perform a login, and end by verifying that the login was correct.
Leaptest ships with a demo desktop application that we will use through out the training lessons. The demo application contains the most normal elements that you will find in a desktop application including lists of data, search functionality and a form with different kind of fields. You can use this to practice your Leaptest skills or try out different kind of automation cases.
In the videos we are starting the application from an icon in the task bar. So let me show you how you can add this easily. I start by unpinning it from my task bar. To add it to the task bar simply navigate to the Leaptest installation folder, typically on the c-drive in the “program files” folder. In the Studio folder, right-click the “Leaptest.DemoDesktop.exe” and click “Pin to Taskbar”. This will add the dark blue Leaptest icon to your task bar for easy access to the demo app.
With the demo application added to the task bar – Let’s start with the beginning!
We have selected “Projects” in the main menu on the left, which gives us a list of all existing projects. In this case I have only one project, and I will start by creating a new project.
(Create new project)
In the Project popup we specify a name for the project – “Desktop UI – Lesson 1”. We’ll just keep the rest of the values and click “Save”. A project is the highest level of category when you organize your test cases.
Under the new Project, I select to create a new test case by clicking “new case”.
(Create new case)
We specify a title and select the case type “Desktop UI”. This ensures that we have the right perspective in the case and that we have access to the desktop automation features.
Test cases in Leaptest are flows made up of building blocks, and we design and maintain the flows on the design canvas. When we create a new test case, we only have one building block to start with – the Start building block. We can move the building block around on the canvas, and we can zoom and center using the buttons in the lower right corner of the canvas. We can also pan the canvas using the mouse, either by pressing down the space bar or by clicking the pan icon in the lower right corner.
When we build a flow we start by pulling the connector on the start building block. The connector is flexible and we can add the next building block where ever we want. When I release the connector, the building block menu pops-up and shows all the categories of building blocks. We can either open a category and select a building block or just start typing if we know the name of the building block. In this case we will start with a Start Application Building block which is used for opening a desktop application.
Once it’s added we can see a green arrow from the Start block to the Start Application block which indicates the direction of the flow when the case executes.
You can say the green arrow drives the execution of the flow.
In the Start Application building block we can either specify the name of the application or the path to the application, but the easiest way is to capture the application that we want to open.
I already have my Leaptest demo application running, so when I click capture we can use the mouse to select this application. Once selected all details about the application is captured back into the Start Application building block so it’s now ready to execute.
We select “Close all windows” in the Start block to ensure that we have the same starting point for every run of the test case and click on the Play icon. This will run the test case in preview mode. As we can see the already open application was closed and a new instance opened.
When the demo application opens we get a login box, and we need to insert username and password. To do this we add a “Set UI Element Value” block after the start application block. This will find and set the value of a selected element – in this case the username field – when the test case is running.
To select the element I click “Capture new element”. Leaptest now minimizes and the entire desktop is now in capture mode. This means we can use the mouse to select the element we want to set a value in. In this case I select the username field in the login box, which captures the field back into Leaptest. We have a Text Value field where we can input the text we want to insert – in this case the user “Test”.
We do the same with the Password – the only difference is that we select the option “Password” so the password is not in clear text inside the test case. The final piece in the login is to click on the login button. I add a Click UI Element and capture the login button.
Instead of re-running the entire case to verify the logic, we can just right-click one of the building blocks and select “Run case from here”. In this case the test case will attach itself to the already open application and just execute from the select building block. This makes it easy to do a step wise, progressive design of
the test case, while constantly making sure that the functionality works as intended.
When the test case runs, we record a video of what goes on, so we now have a visual representation of everything that happened. If I scrub the video we can see that the building blocks lights up when they are active, and that the activity log on the right is also following the video. These tools in combination makes it very easy to debug a test case.
Also be aware, that the default state of the test case is Failed, unless we explicitly set the status to Pass, which I will show in a minute.
The last part of the login process is to verify that the login went well, and I will do this by looking for an element on the screen that will only appear if the login went well. In this case name of the logged in user in the lower left corner of the main window. I add a Find UI element, capture the user part and add a Pass block if we can find this element.
Let’s run the entire test case from the start.
(Automation case runs)
As we can see, the case passed.
In this video we introduced how you create and design test cases for desktop automation in Leaptest.
We saw how to run and debug test cases and how to open and capture desktop elements from applications.