Record and Playback is one of the many quickest and easiest ways to create automated tests.
During the 3 chapters, you will learn how to use Record and Playback in Katalon Studio to:
In the first chapter, we will quickly walk through Katalon Studio – a free testing tool with Record and Playback. Then, you will learn how to use it for recording tests while performing manual actions on web pages.
In the second chapter, you will know how to reuse the previous test case to form a new one. To do this, you will add new recorded steps to the existing ones, which can also be the way to update any test case when the UI or workflow changes.
And in the final chapter, we show you how to do test recording right on your active browser where you’re working. This will help you save time and avoid duplication of test assets since you don’t need to record all the precondition steps to reach the current state of your UAT.
Note: You can download and use the sample project we used in this course here: https://github.com/katalon-studio/record-and-playback-sample-project
In this first chapter, I will show you how to create a new simple test case from scratch, using Record & Playback in Katalon Studio. So, what I got here is a brand new project. If you haven't downloaded the tool yet, just pause this video, hop over to katalon.com/download, install and you'll be good to go.
When Studio is ready, open it, go to 'File' >> 'New project' and this box will appear. Give your project a name. Choose the type. Let's go for 'Web'. There are other options below where you can connect to sample projects or other platforms. But just leave them for now.
On the left, you can see there are many folders under the Tab 'Test Explorer.' Let's go over each of them briefly. 'Test Profile' is where to input and control the different environments that you want to run your tests on, like Staging or Production. 'Test Cases,' like its name, is where all of your test cases are stored. 'Object Repository' contains all of your test objects that you're going to interact with. 'Test Suites' is where you gather test cases according to different groups, like regression tests, smoke tests, or one particular feature.
'Data Files' is where you save all the files for data-driven testing, which we'll talk about in another course. 'Checkpoint' is for implementing certain features to verify specific test steps. 'Keyword' is where you add your customized keywords (you can find the available ones in Studio by clicking on this icon on the left here). 'Test Listeners' is where you can create the scripts to interfere with the test steps when needed. For complex projects, you'd definitely need this. 'Reports' is simply the place containing all the reports for your test suite executions.
Here we have 'TestOps,' Studio's built-in reporting and test orchestration platform. You can connect Studio to TestOps to store and analyse all of your results with advanced analytics and charts. 'Include' is where you can use other functionalities like Behavior-Driven Development or BDD Testing and scripting. 'Plugins' is where you can connect the Studio to other applications and platforms. You can go on Store dot Katalon dot com to see all the available plugins there.
Now you have created a project and understand the basic structure of Katalon Studio. Let's go ahead and create a new test case. Right-click on the 'Test cases' folder > 'New'. There are 2 options here. If you want to put your test case in a new folder, you could choose 'Folder'. But for now, let's click on 'Test Case'. Then, give it a name. Here, I'll name it 'Login' since we're going to record a test case for this function.
To start recording, on the top menu, click on the 'Record Web' button and this window will appear. Now, type in the URL that you want to test here. I'll use Katalon's demo website, CURA Healthcare Service. Here's a quick explanation of the different sections you see here. On the left, the Recorded Actions will capture all the steps you take on a webpage. And over on the right, the Captured Objects/Object Properties/Selected Locators will let you see more of a detailed look on all the captured objects you've interacted with during the whole recording session.
Next, when clicking on the 'Record' button, the CURA Healthcare website will immediately open. This results in the first two actions being recorded on the screen, which are 'Open Browser' and 'Navigate to URL'. The same applies for every action you take and every object you interact with on your AUT. Now, I will go ahead and perform all the manual steps to login to an account. Alright, click on this 'Make appointment' button. Type in the user name and the password. Then 'Login' last and we're done!
Now, what we need is an element to verify this login step. I'll use this 'Logout' text in this expanded menu for verification. Right-click on the text, point to 'Katalon Studio' and choose 'Verify Element Present'. Having created all the steps for our test case, close this window then we're going to run, or playback this test case to make sure all the steps work properly. Click on the 'Playback' button to go through each step again.
Looks like everything is good. The final status here is 'Passed' so we can go ahead and click on 'Save script' on the bottom here. This dialog box will appear, asking if you want to add these new test objects to the Repository in a new folder. We'll discuss this section, test objects and repository, in another course. For now, just click 'OK'.
Alright, let's have a look at our result. You can see all the recorded steps have been saved in our 'Login' test case. And all of the objects are saved in the repository as well. Now, let's run this test for the last time, just to make sure it won't fail. While that is going, you can switch to this Log Viewer to see all the details. The green tick indicates success while the red X means the step failed.
Let's wait for a few seconds. And it's done! All green! And there you have it, how to create a simple test case using Record & Playback. Easy right? No code needed, just perform all the steps manually and let Katalon take care of the scripting. In the next chapter, we are going to create another test case by adding additional steps to this one.
Hi and welcome back! In the last section, we learned how to quickly automate tests with Record & Playback. Following that, to avoid wasting time recording the same steps for different test cases, we'll continue with creating a new test by adding more steps to the one we've made.
Using the same example with the Cura Healthcare website, let's create a new test case to book an appointment. Right-click on the 'Test Case' folder, point to 'New', and select 'Test Case'. I'll name it 'Booking an appointment'. Click on 'OK' and a new tab will appear. According to the website's logic, you'll need to log in to an account to book an appointment. This means our test case must have the needed steps to replicate what a successful login is like.
You could hit the 'Record Web' button and start recording everything from scratch, open the web page, click on certain buttons, and type in the username, password, and continue from there. But that's NOT what we're going to do. Instead, we're going to re-use the 'Login' test case. This is one major benefit of test automation and with Katalon in particular. It allows you to add and reuse your resources for further applications so that you can avoid doing repetitive tasks.
Back to business. Drag and drop this 'Login' into the tab on the right. All there's left is to record the additional steps right? Not just yet! That's because the last step of this 'Login' test case is to 'close the browser'. If we leave it just like this and go on recording with the browser closed, this test would fail 100% since it wouldn't be able to proceed to the next actions.
That being said, I'll go back to the 'Login' test case, remove the last step, double click on it, select the last step, 'Delete' and remember to 'Save' the change. Returning to the 'Booking an appointment' test case, I'll hit 'Record Web' to start. This 'Warning' dialog will appear, informing that this test case has unsaved changes. You can know if you've saved your test case yet by spotting the * at the beginning of its name. Just click on 'OK' to save its current state and continue.
After that, a new 'Confirmation' box will pop up, asking whether or not you want to continue recording. Let's say, we select 'No, I want a clean session'. This Web Recorder window will appear. Click on 'Expand' and you can see that all the Login steps are NOT included in here. This means you need to record everything from scratch, the login steps included.
So, let's exit this window to go back and click on 'Record Web' again. This time, choose 'Yes'. And in the 'Recorded Actions,' the 'Login' test case is included. Then, click on 'Playback' to run all the existing steps to open the browser and navigate to the Booking screen. Wait for a few seconds. And it stopped. From here, I will continue to perform the next steps manually to book an appointment.
Alright, let's choose Hong Kong. Check on this and this. Choose the appointment date. Type in 'No comments'. And click on 'Book Appointment'. It will take me to this page where we will verify this test case. Right-click on this text, 'Appointment Confirmation', point to 'Katalon Studio' and choose 'Verify Element Present'. Everything is done. Let's close this window.
Let's run them back and wait for a few seconds. The status is 'passed'. All good, let's save this script. Again, this dialog box will appear, giving you the options to add new objects to the repository or update the existing ones. In this case, they are all new objects. Click 'OK' to save them. We'll discuss these test objects and repositories in another course. Make sure to subscribe to Katalon email list to be notified when that comes out.
Now, it's asking whether you want to append or overwrite the recorded actions over this test case. Click 'Append', it will keep the existing step(s) and continue to add in all the recorded actions. As a result, you can see here, there is a duplication of 'Call Test Case'. Go ahead and delete the first one. Or to prevent that, you could go for the 'Overwrite' option. It would replace the existing step(s) with the recorded actions, so there wouldn't be any duplication. The result would be exactly what you are seeing on the screen here.
Now, let's execute this test again to make sure everything can run smoothly. And it passed! We have successfully created a new test case by adding more steps to the previous one. In the next video, I will show you how to use Katalon Studio to record test steps on your active browser.
Tests like E2E tests consist of a large number of steps and actions to both record and run by. With the current active browser you're working with, say Firefox or GG Chrome, Katalon Studio gives you the ability to start recording right from the step that you want without going all the way from the top. So for example, your scenario has 10 steps, you'd be able to just start working from step 9 instead of starting from step 1.
So, I have created a new test case, named 'Active browser'. And for this demo, we'll continue to use the CURA website as our UAT, but this time, we only want to start recording from the steps I've made on the Make appointment page. If I go ahead and hit 'Record', just like we did in the previous videos, it will open and navigate to the predefined URL.
Instead of doing everything from scratch from here, I'll work from the successful login page on an active browser. Click on this dropdown icon and choose Chrome from the Active browser options. This pops up a message saying 'Katalon Recorder extension is required for capturing objects in active Chrome tabs that were not opened by Katalon Studio' (meaning your active browser).
In case you don't know what Katalon Recorder is yet, it's a Selenium IDE alternative for web browser automation. If this is your first time, quick pause this video, click on 'Install extension' and resume back after you're finished. You'll be navigated to the download store based on your default browser. I'm using Chrome, so I'll click on 'Add to Chrome', 'Add extension' and then turn it on. Quick and simple.
I'm all set. Let's remove all the existing steps, select my active browser again, choose 'Continue recording,' and I've got the first 2 recorded actions: 'Open browser' and 'Navigate to CURA homepage. Have a look. This is the browser I'm currently working on, where I have logged in the account and navigated to the Make appointment screen.
To briefly explain, when working with e2e tests on an AUT, there would surely be a specific workflow or scenario to go through a lot of screens and preconditions. With cases like this, recording from the first step basically is the same as starting all over. That's why using 'Record on an active browser' in Studio will save you loads of time.
As I'm selecting and pressing different areas on the webpage as a normal end-user would, the actions are simultaneously recorded. Let's type in 'Something' here, book the appointment, and go back to the homepage. I've performed all of the actions I wanted, so I'll click stop. Everything seems good.
But on second thought, I don't want to go back to the homepage, so I will remove that step, replace it with a 'Verify Text Present' by manually adding it and selecting from the content-assist utility. Over in the input column, I'll type in 'Something' input from the step 8, switch this to 'true,' OK, save to add these to a test case, then OK! Alright. I'll hit run and watch it run from the top. Open up the browser and it's just standing there.
Let me go ahead and investigate. So, it stops here at step number 3. By the look of this, the test is still running, but it cannot proceed. Ah, so here, it hasn't logged in to the account. So, let's stop this test. The problem here is that the Login step is missing in the test case, causing it to not be able to navigate to the Make Appointment screen.
What I'm going to do now is reuse and add the Login test case that we've recorded in the first chapter. Simply drag it over here, get rid of these steps, and done! Time to re-run it and see what happens. Again, reusing your test artifacts and assets is always a good practice in test automation. You should not duplicate what you already have, save that time having to recreate them again, and speed up the test creation process.
Alright, open a browser window, type in the credentials, and navigate to the Make appointment page yada yada yada and sweet! Everything has passed. Well, you've seen me mess up and that should be something to keep in mind for you. Remember to do the preconditions for your test to reach a specific stage, in this instance would be having the login step to be able to go on to the 'Select option by value.'
In this Log Viewer, you can see the execution results in the order of the recorded steps. Now, I will add in a final step to close the browser, save it, and re-run this for the last time. Again, it will open a new browser, and perform all the steps, including those in the Login test case and then what we have recorded on my active Chrome earlier. As expected, it passed, with the last step of closing the browser.
That's the end of this chapter. I have shown you how to record on an active browser. Isn't so hard, right? One thing to remember is that if there's something wrong, no biggie, humans make mistakes. Just go back, have a closer look at the preconditions or anything that might've been responsible for that error.
Well done! You've finished our Record & Playback course. To recap, you've learned how to record a new test case from scratch, reuse test artifacts to create tests, and record a test case on an active browser. So what's next? It's time for you to practice what you have learned. Just go to Katalon.com, download, install the Studio for free, and start automating some simple test cases right away with Record and Playback.
It goes without saying, practice makes perfect. That's why Katalon Academy is working on even more courses to help you learn about test automation and immediately put them into practice with Katalon tools.
Much better than the first courses!
Embedded subtitle might help to understand better for non-English speaker
Good content but the video resolution is really bad.
I couldnt find a way to increase the current resolution
Perfect to begin.
very useful for beginners