Implementing Automated Software Testing by Neha Kaul
Implementing Automated Software Testing by Neha Kaul
Testing
IMPLEMENTING AUTOMATED
SOFTWARE TESTING
Neha Kaul
ARCLER
P r e s s
www.arclerpress.com
Implementing Automated Software Testing
Neha Kaul
Arcler Press
224 Shoreacres Road
Burlington, ON L7L 2H2
Canada
www.arclerpress.com
Email: [email protected]
This book contains information obtained from highly regarded resources. Reprinted material
sources are indicated and copyright remains with the original owners. Copyright for images and
other graphics remains with the original owners as indicated. A Wide variety of references are
listed. Reasonable efforts have been made to publish reliable data. Authors or Editors or Publish-
ers are not responsible for the accuracy of the information in the published chapters or conse-
quences of their use. The publisher assumes no responsibility for any damage or grievance to the
persons or property arising out of the use of any materials, instructions, methods or thoughts in
the book. The authors or editors and the publisher have attempted to trace the copyright holders
of all material reproduced in this publication and apologize to copyright holders if permission has
not been obtained. If any copyright holder has not been acknowledged, please write to us so we
may rectify.
Notice: Registered trademark of products or corporate names are used only for explanation and
identification without intent of infringement.
Arcler Press publishes wide variety of books and eBooks. For more information about
Arcler Press and its products, visit our website at www.arclerpress.com
ABOUT THE AUTHOR
List of Abbreviations..............................................................................................ix
Dedication............................................................................................................xi
Preface................................................................................................................xiii
Bibliography........................................................................................... 255
Index...................................................................................................... 259
LIST OF ABBREVIATIONS
To my wonderful husband, Sibin, you have been a source of constant support and
encouragement.
To my parents, Virender and Anita, who always pushed for tenacity.
To my sister, Nidhi, for your wisdom and unconditional love.
PREFACE
Software systems are an essential component of our day-to-day lives. Software has
morphed into one of our most basic necessities. We depend on software to accomplish
routine tasks and activities in our lives. The impact that software has made in this world
is enormous. Software applications are engaged on a large scale in both essential and
non-essential sectors across the world. The immensity of the involvement and impact of
software in the world is enormous. Software applications and systems help in complet-
ing complex tasks in an easier and cost-effective way which has improved the quality
of life of millions of people.
The relevance of software will only increase in the future. Software will continue to
increase in complexity as it is going to be used to solve the biggest problems faced by
the world. It is a proven fact that as the complexity of software rises, the challenges
associated with software testing and software maintenance will subsequently rise too.
Complex software solutions created to solve complicated problems are destined to have
an element of complexity in the process of testing as well. It is a known fact that there is
a direct relation between the quality of a software system and testing. Effective testing
is thought of as a measure of efficiency and quality of software. Testing is a vital non-
skippable step in the software development lifecycle.
The field of software testing has grown considerably since its origin in the early 1900s.
Testing of software helps instill confidence in the quality of the software to its users and
stakeholders. It is advisable that software be evaluated and tested thoroughly as it is vul-
nerable to a range of potential attacks that may be of a malicious nature. Comprehensive
testing and evaluation of any software solution is paramount to identifying vulnerabili-
ties in the system and shield it from potential attacks. The lack of quality testing is one
of prime reasons for the failure of software systems resulting in significant losses for
the stakeholders, clients, and users. One can assume with certainty that software testing
is a determining factor in the success of a software solution.
Over the last few decades, the field of software testing has grown exponentially. A
branch of software testing namely automation testing has helped reshape the way in
which testing is done. Automation testing is the exercise of executing tests automati-
cally in a repetitive manner. This branch of study concentrates of execution of repetitive
tests, management of the test data and the utilization of the results to ameliorate and
improve the quality of software. In this book, we will investigate the automation testing
field within software testing. The advantages of this type of testing will be discussed in
brief. Further, different software solutions that perform automation testing will be pre-
sented and examined in this book. The implementation of different automated software
systems will be presented in detail. Detailed practical implementations of automated
software applications covering different types of testing scenarios have been provided
in this book. This book assumes that the audience is familiar with the basic concepts of
software testing.
CHAPTER 1
SOFTWARE TESTING: DEFINITION
AND IMPORTANCE
CONTENTS
1.1. What is Software Testing?..................................................................... 2
1.2. Importance of Software Testing............................................................ 2
2 Implementing Automated Software Testing
excellent measure of the quality of the software product. The better the
product is tested, the better it performs consequently improving its quality.
• Cost Effective: Contrary to the popular belief, software testing
is successful in reducing long terms costs of a software product.
The development of a software solution is a complex process
made up of several stages in its life cycle. If issues or bugs are
detected during the initial phases of the development cycle,
the cost of rectifying the mistakes is less. As the stages of the
software development process move towards release it becomes
harder and costlier to correct errors. An error found after the
product has been released would incur maintenance costs and
costs pertaining to releasing an updated version of the software.
A similar defect found in the development phase would not cost
the same. Testing done at an early stage in an iterative manner is
helpful in identifying all possible defects before the product is
handed off to the users.
Issues found after the software product has been released incur losses
that are not just of a monetary nature. In additional to reduced sales of the
product due to its poor quality, if an application has several defects that are
present in the final product there could be loss in terms of reputation and
customer satisfaction. If customers are not satisfied with the product, they
could switch to using other products of a similar nature. They could lose
trust in the company and be wary of entering into a professional relationship
with the same firm in the future which is less than ideal for the company.
Software testing, on the other hand, is an excellent tool for avoiding
such disastrous results. It serves as a pocket-friendly approach over time.
It is an investment that will benefit the project in terms of its budget and
quality. Additionally, proper testing uncovers more defects which in turn
reduces the maintenance costs which ends up as an economical decision in
the end. The price that is paid by implementing software testing practices is
definitely worth the returns acquired owing to the success of the well-tested
and accurately functioning software product.
• Customer Satisfaction: The primal intent of designing and
releasing a software product is to deliver a product that meets
the expectations of the customer. The goal of the entire process
of development is to provide the best possible product to the
customer and ensure that he is satisfied with the product. As the
customer/stakeholder is the one paying for the product, his/her
6 Implementing Automated Software Testing
CONTENTS
2.1. Introduction....................................................................................... 10
2.2. Benefits of Automation Testing........................................................... 10
2.3. Types of Automation Tests in Software................................................ 16
2.4. Different Automation Testing Software............................................... 23
10 Implementing Automated Software Testing
2.1. INTRODUCTION
Automated testing is the implementation of software tools to automate the
manual process of reviewing and validating a software product (Dustin,
Rashka, and Paul, 1999). Test automation is used to perform automation of
tasks that are repetitive in nature and perform testing tasks that are difficult
to perform in a manual setting. Automation Testing is a technique of software
testing which follows the basic principle of software testing which is to test
the product and then compare the expected results with the actual outcomes.
The difference is that in case of automated testing, this process is done by
means of an automation testing tool or test scripts.
Automated software testing is in most cases done by using an automation
tool. This is so that the quality assurance team can focus on other tests
that require manual intervention and input. Doing so will increase the test
coverage and render the project scalable. The automated type of software
testing is usually well matched and compatible with large-scale software
development projects that require testing of the same sections again and
again and projects that have already covered an initial iteration of manual
testing. In the next section, we look at some advantages of automated
software testing.
generated; they can be reused any time with incurring any supplementary
costs. Despite the initial hurdles in terms of money for the adoption and
implementation of automation testing, the pros of automation outweigh the
cons, in this case, money. One must remember that the size and depth of
adoption of automation testing determines the return on the initial investment
in automation. The more one uses automation and creates tests, the higher
the returns accrued. The higher the number of test cases and test suites, the
better the returns on the money spent for adoption of automation.
What automation testing does is that it liberates time that could be
used to focus on cases where manual testing is necessary. Larger and more
challenging issues such as customer inputs, improvements, and functionality-
related topics can be covered by the quality assurance team. Automation
helps reduce the need for revising the code several times, and in due time, it
pays for itself. Furthermore, every time the code of the software is changed,
the automated tests can be re-executed as many times as desired with no
supplementary overhead and cost. Another way to be cost-effective by using
automated testing is to execute tests in a parallel manner. Instead of running
the test cases or test suite or test scripts individually, one can use parallel
testing, thereby allowing you to execute multiple tests that are automated at
the same time. This way, considerable amount of time and effort is reduced.
The sizeable reduction in terms of execution time of automated tests can
then be put to good use to take care of other needs of the project.
• Faster Software Development and Delivery: Automation
of testing in software allows one to execute tests that can be
executed repeatedly and with speed. This will save a lot of time
that would have been spent on manual testing. The testing team
would not have to wait for longer periods of time to obtain the
results of execution of the tests. They would obtain the results in
a few hours which would help them give feedback, if any, to the
development team rapidly so that they could correct the defects.
Once the code is changed, rerunning the tests would incur no
overhead; one must simply execute the scripts again. This not
only reduces time, but all reduces the development cycle and
helps release the product frequently. Owing to the rapid execution
of test cases and the repeatable quality of the tests, automation
easily augments the speed in which the software is developed.
Automated Software Testing 13
The security tests may vary from application to application, but based
on the system being built, a set of security tests tailored for the system under
consideration can be proposed and executed. As such tests are usually static
in nature and would not change regularly, they can be easily automated.
The ways in which one tests the basic authentication and authorization of
a software application is a testing standard and hence security tests can be
automated with ease (Potter and McGraw, 2004).
• Performance Tests: It is a non-functional type of test that aims
to test the response of the software under test. This testing is one
of the most frequently implemented testing techniques amongst
all the different non-functional testing. A performance test aims
to observe the way the software application responds under
normal conditions. The intent is to check if the expected network
load is handled well by the system and that the performance falls
under acceptable standards. For instance, the response time to
open a website should ideally not be longer than a minute under
normal circumstances. If it takes more than a minute, it means
that it does not respond well to the load it receives. The load that
can be handled by the system is tested using performance tests.
Responsiveness and stability of the software to handle its regular
influx of requests is measured and evaluated by performance
tests.
In most cases, the expected system load and expected responsiveness
of the software is already determined before the development has started.
Performance tests determine whether the system responds the way it is
supposed to respond under regular working conditions. The parameters are
usually pre-defined and do not vary that much making performance tests a
good pick for automation.
• Acceptance Tests: These are tests that evaluate the software
system based on its functionalities, its behavior, and capabilities.
In short, these tests inspect the software system for its readiness
to be deployed and released to the market. This test checks
whether the business needs of the client are satisfied by the
system. Acceptance testing implies that the system is ready
to be evaluated by the potential users of the system (Humble
and Farley, 2010). It entails the testing of the acceptability of
the system by the end-user or the business user. The software
application is tested and evaluated by means of acceptance tests,
and it is decided by the stakeholders/clients/customers whether
Automated Software Testing 21
1. Unit Testing Phase: As can be inferred from the name ‘unit tes-
ting,’ this phase of testing focuses on testing and evaluating in-
dividual units or components of a software application (Beizer,
2003). Unit tests are executed during the course of development,
ideally by the development team before they hand over the sys-
tem to the quality assurance for testing. Unit testing is usually
done manually by the development team (Beizer, 2003). This
phase of testing is ordinarily the first phase of testing which is
done mostly manually. But, with a little planning and discus-
sion, it can also be automated.
2. Application Programming Interface (API) Testing Phase: It
tests the business layer of the software application under test.
Software applications that are built on APIs and that support API
architecture usually employ API testing (Bangare et al., 2012).
Any software system that is based on API architecture can im-
plement API testing. This type of testing is meant to validate the
business layer of the software system by inspecting the response
time of the APIs used in the application for all the requests. Se-
veral test combinations of request-response for various APIs
that the application in built on are executed. APIs are akin to
middlemen that connects different systems used by the software
application in a smooth manner. Due to its nature, API testing
is usually done after the software development is complete to
guarantee that a smooth integration within the systems and the
software under test. API testing is a flexible process which could
be conducted prior or after the UI Testing phase. As API tests are
of a typically fixed nature that follows the theme of request-res-
ponse, it is an excellent contender for automation. As API tes-
ting is like integration testing, some teams include API testing
within their integration tests.
3. User Interface (UI) Testing Phase: This phase is the last phase
of testing in case of a large group of software projects. The UI
is the what the customers/users interact with and hence is an
important part of the testing process. UI testing is carried out
by quality assurance engineers or testers after the application
has been deemed to be stable by the other tests (McGraw and
Hovemeyer, 1996). This phase focuses on examining the fron-
tend of the software, its functionality and the look and feel of
the application. This phase is focused on replicating the most
Automated Software Testing 23
Telerik Test Studio Telerik Test Studio is a licensed, paid automation tool which
is used to test desktop, web, and mobile applications.
Appium It is an open-source test automation framework that can be
used for testing native applications, mobile applications, and
hybrid applications.
Serenity It is a free open-source library that aids in writing automated
acceptance tests.
TestComplete TestComplete is an automation test tool for GUI testing and
is capable of testing desktop, web, and mobile applications
(TestComplete, 2022).
Silk Test Silk test is a licensed automation tool for functional and
regression testing developed by microfocus which supports
cross-browser testing and can test desktop applications, web
applications, mobile applications, web applications, enterprise
applications and rich client applications.
Over the next chapters, we will study the following three automation
testing tools: Katalon Studio, Watir, and Ranorex Studio.
CHAPTER 3
KATALON STUDIO
CONTENTS
3.1. Introduction....................................................................................... 26
3.2. Installation......................................................................................... 26
3.3. Practical Implementations/Examples.................................................. 38
26 Implementing Automated Software Testing
In this chapter, we cover the automation tool Katalon Studio. This chapter
introduces Katalon Studio, covers its installation process, and them
demonstrates its use.
3.1. INTRODUCTION
Katalon Studio is a robust and easy-to-use automation tool which was
initially released in January 2015. It was first released with an engine that
was selenium-based. It is an automation testing tool that was designed
to create scripts for automation without having to code. The platform is
a simple and straightforward tool for automation that does not require in
depth knowledge of programming. It is an excellent automation tool that
supports testing on multiple platforms and allows execution of automated
GUI tests. Additionally, this platform permits execution of tests on a variety
of operating systems (Eriez, 2009).
Katalon studio offers desktop, API, Mobile, and Web solutions. Katalon
studio offers an excellent IDE that is easy to use and generate automated
test scripts (Eriez, 2009). It was initially released as a free solution but now
boasts of an Enterprise version that was introduced to provide additional
options. But the basic Katalon Studio version that was intended for
individual users still is free of charge (Katalon | Simplify Web, API, Mobile,
Desktop Automated Tests, 2022). In the upcoming section, we shall look at
the process to install Katalon Studio on your machine.
3.2. INSTALLATION
Katalon Studio is very easy to install on any machine of your choice. Here,
we install the version designed for individual users on a 64-bit Windows 10
operating system.
The steps followed are as follows:
• First, navigate to the Katalon studio website: Katalon | Simplify
Web, API, Mobile, Desktop Automated Tests.
Katalon Studio 27
We create an account and click on the ‘Get Started!’ button. You will
receive an email asking you to verify your account. Once your account is
verified, you can log into your account.
Once you log into your account you are directed to the following page:
Two options are provided namely Katalon Studio and Katalon TestOps.
We will be focusing on Katalon Studio in this book. Hence, we click on
the link that says, ‘Create your first test’ (‘Create Your First Test,’ 2022).
Katalon Studio 29
This will redirect us to the download page where the download will
begin instantly.
Once the download terminates, extract the package, and start the
installation by clicking on ‘katalon.exe’ which will launch the tool.
To activate Katalon studio, you will need to enter the credentials that
you used when signing up for the free account (Eriez, 2019).
30 Implementing Automated Software Testing
Once the product has been activated, the Quick Guide screen is
displayed which guides you through the significant features.
At the end of the introduction, Katalon Studio suggests creating a new
project which we follow. Then, we proceed to creating and running a test
case as prompted by the quick guide by clicking on ‘Create and Run your
First Test.’
The steps followed are:
Katalon Studio 31
We click on the HTTP header tab to check if the header has been updated.
Katalon Studio 33
The headers tab can be used to add additional headers. Once the header
is verified, we are prompted to check the request body.
As shown in the screenshot below, the request body is in a simple JSON
form.
Now that the basic parameters of the request are in order, we save the
request, and we can simply execute the API to test if it works. We click on
the play button at the top right corner of the request screen to execute the
request.
34 Implementing Automated Software Testing
The response is shown in the response tab located right next to the
request tab on its right.
We click on the ‘+’ button to create a new test suite and add this test case
to the test suite.
Katalon Studio 35
The editor view of the test suite is presented, which allows to configure
the test suite.
We are directed to check the script view of the test suite. Here, we can
see the code that is generated when a test suite is created. If you wish to
program the suite in a specific way, it can be done from the script view.
We do not make any changes to the script and save the test suite. We
now proceed to execute the test suite by clicking on the play button at the
top as shown in the screenshot below:
36 Implementing Automated Software Testing
The results of the test suite are shown in the log viewer section at the
bottom of the screen.
Once the test has been completed, we check if the request was sent
correctly by looking at test case results. We can see that the request was sent
correctly, and that the status code of the response was 201(OK).
We proceed to importing multiple requests from another source. We go
to the ‘Import API’ tab and click on ‘OpenApi2’ to open a sample API from
the sample source files.
Katalon Studio 37
We are led to a window that asks for the file location to import the API.
A pre-defined link is provided for the purpose of the demonstration. We
click on OK to import the API.
As we can see from the screenshot below, the newly imported API looks
like the API we created and ran previously.
38 Implementing Automated Software Testing
This ends the demonstration, and we can click on the ‘Clap!’ button to
advance to the end.
3. We now add the rest API to the project. To add the restful API to
this project, right click on object repository, then go to New →
Web service request.
4. The following window prompt for entering the details of the Web
service request pops up.
Katalon Studio 41
In this example, we will be using the ‘users’ resource from the online
rest API provider JSONPaceHolder. Hence, we give the name ‘GetUsers.’
We select the type of Request, RESTful in our case. We can also provide
the API URL (URL of the dummy REST API). The URL could be left blank
at this step.
We click ‘OK’ to create the request.
The request is created as shown below:
5. We now edit the request to update the URL, http method and
other API-related details.
“geo”: {
“lat”: “-43.9509”,
“lng”: “-34.4618”
}
},
“phone”: “010-692-6593 x09125”,
“website”: “anastasia.net”,
“company”: {
“name”: “Deckow-Crist”,
“catchPhrase”: “Proactive didactic contingency”,
“bs”: “synergize scalable supply-chains”
}
},
{
“id”: 3,
“name”: “Clementine Bauch”,
“username”: “Samantha”,
“email”: “[email protected]”,
“address”: {
“street”: “Douglas Extension”,
“suite”: “Suite 847”,
“city”: “McKenziehaven”,
“zipcode”: “59590-4157”,
“geo”: {
“lat”: “-68.6102”,
“lng”: “-47.0653”
}
},
“phone”: “1-463-123-4447”,
“website”: “ramiro.info”,
“company”: {
44 Implementing Automated Software Testing
“name”: “Romaguera-Jacobson”,
“catchPhrase”: “Face to face bifurcated interface”,
“bs”: “e-enable strategic applications”
}
},
{
“id”: 4,
“name”: “Patricia Lebsack”,
“username”: “Karianne”,
“email”: “[email protected]”,
“address”: {
“street”: “Hoeger Mall”,
“suite”: “Apt. 692”,
“city”: “South Elvis”,
“zipcode”: “53919-4257”,
“geo”: {
“lat”: “29.4572”,
“lng”: “-164.2990”
}
},
“phone”: “493-170-9623 x156”,
“website”: “kale.biz”,
“company”: {
“name”: “Robel-Corkery”,
“catchPhrase”: “Multi-tiered zero tolerance productivity”,
“bs”: “transition cutting-edge web services”
}
},
{
“id”: 5,
“name”: “Chelsey Dietrich”,
Katalon Studio 45
“username”: “Kamren”,
“email”: “[email protected]”,
“address”: {
“street”: “Skiles Walks”,
“suite”: “Suite 351”,
“city”: “Roscoeview”,
“zipcode”: “33263”,
“geo”: {
“lat”: “-31.8129”,
“lng”: “62.5342”
}
},
“phone”: “(254)954-1289”,
“website”: “demarco.info”,
“company”: {
“name”: “Keebler LLC”,
“catchPhrase”: “User-centric fault-tolerant solution”,
“bs”: “revolutionize end-to-end systems”
}
},
{
“id”: 6,
“name”: “Mrs. Dennis Schulist”,
“username”: “Leopoldo_Corkery”,
“email”: “[email protected]”,
“address”: {
“street”: “Norberto Crossing”,
“suite”: “Apt. 950”,
“city”: “South Christy”,
“zipcode”: “23505-1337”,
“geo”: {
46 Implementing Automated Software Testing
“lat”: “-71.4197”,
“lng”: “71.7478”
}
},
“phone”: “1-477-935-8478 x6430”,
“website”: “ola.org”,
“company”: {
“name”: “Considine-Lockman”,
“catchPhrase”: “Synchronized bottom-line interface”,
“bs”: “e-enable innovative applications”
}
},
{
“id”: 7,
“name”: “Kurtis Weissnat”,
“username”: “Elwyn.Skiles”,
“email”: “[email protected]”,
“address”: {
“street”: “Rex Trail”,
“suite”: “Suite 280”,
“city”: “Howemouth”,
“zipcode”: “58804-1099”,
“geo”: {
“lat”: “24.8918”,
“lng”: “21.8984”
}
},
“phone”: “210.067.6132”,
“website”: “elvis.io”,
“company”: {
“name”: “Johns Group”,
Katalon Studio 47
“email”: “[email protected]”,
“address”: {
“street”: “Dayna Park”,
“suite”: “Suite 449”,
“city”: “Bartholomebury”,
“zipcode”: “76495-3109”,
“geo”: {
“lat”: “24.6463”,
“lng”: “-168.8889”
}
},
“phone”: “(775)976-6794 x41206”,
“website”: “conrad.com”,
“company”: {
“name”: “Yost and Sons”,
“catchPhrase”: “Switchable contextually-based project”,
“bs”: “aggregate real-time technologies”
}
},
{
“id”: 10,
“name”: “Clementina DuBuque”,
“username”: “Moriah.Stanton”,
“email”: “[email protected]”,
“address”: {
“street”: “Kattie Turnpike”,
“suite”: “Suite 198”,
“city”: “Lebsackbury”,
“zipcode”: “31428-2261”,
“geo”: {
“lat”: “-38.2386”,
Katalon Studio 49
“lng”: “57.2232”
}
},
“phone”: “024-648-3804”,
“website”: “ambrose.net”,
“company”: {
“name”: “Hoeger LLC”,
“catchPhrase”: “Centralized empowering task-force”,
“bs”: “target end-to-end models”
}
}
]
This dummy REST API returns a record of 10 users.
In addition to the URL, we can edit other information such as
Authorization, HTTP Headers, Request Body, etc. Since this is a dummy
API there is no authorization information entered. But, in real-life cases, this
information should ideally be provided.
6. To test this URL, we simply click on the play button located right
next to URL.
We can confirm that the status of the request is OK (return code 200),
and that the response contains the data from the ‘users’ resource from
JSONPlaceHolder.
The response can be viewed in different formats such as XML, html,
and JavaScript.
8. Our API request is set; the next step is to create a Test case for
the API. To create a test case for this REST API, we go to Project
Section, right-click on ‘Test Cases’ and select New → Test Case.
Katalon Studio 51
The following window requesting the basic details of the new test case
is displayed:
Once the name has been entered, click on ‘OK’ to create the test case.
The test case is created as shown below:
When we click on this, a new entry is added to our test case, and we can
select the keyword of our choice from the drop-down list.
Katalon Studio 53
The three Web Service keywords that we are adding in this example are
as follows:
a. Send Request: This is used to call the API URL. This keyword
is used to send an HTTP request to the web server ([WS] Send
Request, 2022).
To add the ‘Send Request’ keyword, we select it from the available
dropdown:
As we can see from the screenshot above, the Object is null here. We
edit the object to select the correct API Request.
In this example, we call the getUsers web service request that we created
previously as follows:
Once these values are set, we click on ‘OK.’ The changes are reflected
as shown below:
Katalon Studio 57
We edit the input column to add the string value that we wish to search
for as follows:
10. The last step is to execute the test case. To execute this test case,
we simply click on the play button/icon at the top.
Katalon Studio 59
As observed from the image above, the test case is executed with
success. Details of the test case including the different keywords executed,
time elapsed, time taken by each keyword for execution, etc., can be found
in the Log Viewer tab at the bottom of the screen.
In the next example, we will create additional test cases followed by a
test suite.
• Example 2: Creating a Test Suite: A test suite is a collection of
test cases. This can be done by adding multiple test cases and then
executing the test suite in a single go.
In this example, we will learn how to create and execute test suites. First,
we will create another test case and then create a test suite that executes all
the test cases in the test suite.
The steps to be followed are:
1. In the current project, we first create a new API request that get
the details of a particular user by passing the user id in the REST
API URL. Go to Object Repository → New → Web Service
Request and create a new request.
60 Implementing Automated Software Testing
We provide the following URL to get data of the user with the id 2:
https://jsonplaceholder.typicode.com/users/2.
2. To test this, we click on the play icon and execute the request.
As we can see from the above screenshot, the response contains details
of the user with the id 2.
3. We now proceed to create a test case for this API as follows by
going to Test Cases → New → Test Case.
Katalon Studio 61
We proceed to add the following keywords to this test case to test the
request: Send Request, Verify Response Status Code and Contains String.
a. Send Request:
c. Contains String:
Now that the parameters of the test case have been added, we can execute
the test case.
Katalon Studio 63
We provide the name of the suite and click on ‘OK.’ The test suite is
created as shown below:
5. We now proceed to add the test cases to the test suite in this step.
To add test cases to the suite, we simply click on the ‘Add’ button at the
top:
A window that prompts us to select test cases from the current project
is displayed:
Katalon Studio 65
We select both the test cases and add them to the suite by clicking on
‘OK.’
6. To execute the test suite, we click on the play icon at the top.
66 Implementing Automated Software Testing
The test suite containing the two test cases is executed successfully.
• Example 3: Verifying the Response Count: In this example, we
will study the use of the ‘Verify Elements Count’ keyword.
This keyword helps verify the number of elements that were expected in
the response of a web service request ([WS] Verify Elements Count, 2022).
In this example, we will add this keyword to the getUserDataTest test
case that we created in Example 1.
The steps are as follows:
1. Open the ‘getUserDataTest’ test case in Katalon Studio.
3. From the dropdown list, select the option ‘Verify Elements Count’
4. Double click on the input cell to open the Input dialog as shown
below:
68 Implementing Automated Software Testing
As you can see in the screenshot above, we have set the ResponseObject
as ‘getUsersResponse’ which is the variable that captures the result of the
request as defined in Example 1. As ‘getUsersData’ request returns 10 user
records, we set the value for the ‘count’ parameter to 3. Once we enter this
information, we click on ‘OK.’
The changes are made to the entry as shown below:
Katalon Studio 69
Click on the ‘Save’ button to save the changes to the test case.
6. Test the newly updated test case by clicking on the play icon.
70 Implementing Automated Software Testing
As we can see from the screenshot above the test case executes
successfully.
• Example 4: Verifying the Element Property Value:
1. Open the ‘getSingleUserData’ test case in Katalon Studio.
5. The last step is the execution of the test case which can be
launched by clicking on the play icon at the top.
Katalon Studio 73
The API is generated successfully. You can find the definition in lower
half of the page as shown below:
5. Now that the API has been created, we proceed to create a new
Web Service Request in Katalon Studio. We right-click on ‘Object
Repository,’ go to New → Web Service Request.
76 Implementing Automated Software Testing
We then enter the name, description, and URL of this request as follows:
We provide the test case name and click on ‘OK’ to create the test case
as follows:
The test case is added to the list of test cases as displayed below:
We select ‘Send Request’ from the options in the dropdown list, which
adds an entry to the test case.
We edit the input column to search for a particular value from the
response:
The input is updated, and we then save the test case by clicking on the
‘Save’ icon located at the top left section of the window.
9. We execute the test case by clicking on the play icon at the top.
At this point, we provide just the name of the web service request. We
need to select the Request Type which is ‘SOAP.’ The URL can be left blank.
The description is optional too.
We click on ‘OK’ to create the request.
The request is created as shown below:
84 Implementing Automated Software Testing
Once the functions have been fetched, we can see them in the ‘Service
Function’ tab as shown below:
86 Implementing Automated Software Testing
We have also provided the ‘Service Endpoint’ value that contains the
available services list for the WSDL.
When we access the link https://www.learnwebservices.com/services
we see the list of available services as displayed in the screenshot below:
We edit the request body and change the name to ‘NIK’ as shown below:
The results are available in the Response tab on the right. It is as follows:
As visible from the screenshot above, we can see the response which
contains the message ‘Hello NIK!.’
7. Now, we proceed to test this web service request. To create a test
case, we go to Test Cases → New → Test Case.
We are asked to provide the name, description, and tag. We provide the
name and leave the other optional fields blank.
Katalon Studio 89
First, we need to add the ‘Send request’ keyword to call the web service
request and store the response in a variable which will be used in the next
keywords.
90 Implementing Automated Software Testing
The next variable that we add is the ‘Verify Response Status Code’ to
check whether the request returns a 200 (OK) request. The entry is created
as follows:
We edit the Input column and provide values for the parameters
responseObject and expectedStatusCode. We select the ‘response’ variable
that we created during creation of the ‘Send Request’ variable. For the
expectedStatusCode we enter 200 as it is what is expected.
92 Implementing Automated Software Testing
The next keyword that we add is the ‘Verify Element Text’ keyword that
is used for checking the element’s text from the response returned by the
web service.
Katalon Studio 93
As visible from the screenshot above, the location of the field ‘message’
is SayHelloResponse.HelloResponse. We provide this value to the locator
field.
c. Text: This parameter is the value of the ‘message’ property which
is ‘Hello NIK!.’
94 Implementing Automated Software Testing
We click on ‘OK’ to add the changes which are reflected in the entry as
shown below:
As seen from the results of the test case, the test case passed successfully.
10. In this test case, we can also use the ‘Verify Element Property
Value’ to check the value of the message.
This is done as follows:
We click on ‘Add’ then select ‘Web Service Keyword.’ From the
dropdown, we select the keyword ‘Verify Element Property Value.’
96 Implementing Automated Software Testing
We edit the ‘Input’ column and provide the three parameters: request,
locator, and value. These values are the same as done in Step 8.
Katalon Studio 97
As seen from the screenshot above, the package name is already pre-
filled as we had selected the package before entering the menu.
We provide the name of the keyword class as shown in the screenshot
below. By default, the naming rules followed are like those of the Java
language which means that the name of a class cannot start with a number,
contain spaces, or have special characters in it. The naming convention for
the Java language suggests creating a class name using a noun or a noun
phrase and following the camel case rule where the first letter of each word
is capitalized which helps better manage the project (Joy et al., 2000).
Katalon Studio 101
We run the test case by clicking on the play icon at the top. The test case
executes with success. This is visible in the screenshot below:
Once we stop recording, the Web Recorder dialog is updated with actions
that we performed in the browser. This is shown below:
Katalon Studio 107
6. If we are happy with the test case, we can save the script. If not,
you can record again.
To save the script generated, we click on the ‘Save Script.’
When we save the script, we are prompted to also save the element that
we browsed (google page in this case) to the object repository.
To do this, click on ‘OK’ in ‘Add Element to Object Repository’ dialog
as follows:
108 Implementing Automated Software Testing
We can also see that the test cases have an entry pertaining to each action
that we took while recording.
7. To run the test case, we click on the play button at the top.
Katalon Studio 109
CONTENTS
4.1. Important Watir Commands and Terminology.................................. 112
4.2. Watir Installation............................................................................. 114
4.3. Examples......................................................................................... 127
112 Implementing Automated Software Testing
This chapter describes the testing tool Watir. In this chapter, we learn what
this tool is, how to install it and how to use it for automation testing.
Watir is an open-source library meant for test automation which
develop in the Ruby language. The full form of Watir is Web Application
Testing in Ruby and Watir is pronounced as “Water.” This tool helps testers
develop automated tests for testing web applications. The automation tool is
independent of the language in which the application under test is written.
Watir supports the following web browsers: Firefox, Chrome, Internet
Explorer, Edge, and Safari (Watir Project, 2009).
This tool is developed in Ruby and is available as a RubyGems install.
This automation tool is created with the intent of interacting with a web
browser in the same way as humans. Watir mimics user actions such filling
online forms, clicking on different links, opening tabs, etc. (Watir Project,
2009).
The latest version of Watir is 7.1.0. Since it is developed in Ruby, it
requires a user of this tool to possess elementary knowledge of Ruby. To
run Ruby code, you need to install a Ruby interpreter (Watir Project, 2009).
We choose option 1 and 3 and click on the ‘Enter’ button on our keyboard.
nothing but a collection of Ruby code that we put into a “collection” that we
can name later (Pargal, 2020). The Gems software permits us to download,
install, and make use of ruby packages. Each software package that is
downloaded is called a “gem” and each “gem” contains a packaged Ruby
application or a Ruby library.
The gem install command allows us to specify the gems that we want to
use and the versions of the gems that we wish to use (Pargal, 2020).
In simpler terms, the ‘gem install’ command extracts the gem and places
it into a directory on your machine. Here, we are installing the watir package
to our system.
This is shown below:
We do not need to provide the browser name as the default browser for
Watir is chrome.
As we can see, a chrome web page is opened confirming that the driver
has been installed correctly.
124 Implementing Automated Software Testing
We extract the webdriver and paste it in the bin folder of our ruby
installation.
Watir 125
As we can see from the screenshot above, a Microsoft edge browser tab
is opened which indicates that our web driver has been picked up.
This concludes the basic installation of Watir. In the next section, we
look at different examples that demonstrate the creation of test cases and
automation using watir.
Watir 127
4.3. EXAMPLES
In this section, we look at writing test cases and implementing test suites
using watir and ruby gems.
• Example 1: Creating a Simple Test Case to Open the Default
Browser: In this example, we will write a simple test case and
execute it using watir.
The steps followed are:
1. We open a command prompt and create a folder named watir-
tests as shown below:
2. We open the folder and create a new ruby file named test.rb in this
folder.
128 Implementing Automated Software Testing
3. We check the contents of the folder to check that the file is created.
The test case is executed and the URL google.com is opened in the
Microsoft Edge browser as shown below:
The test1.rb file content is very similar to the file test.rb created in the
previous example except the browser command. In this example, we simply
change the second statement where we set the browser.
In this example, we do not specify the browser so that the default browser
is opened.
132 Implementing Automated Software Testing
3. We save the file and proceed to run this file from the command
line.
We can also run the ruby test case directly by double-clicking on the file
which is an executable. We choose to run it from the command line to see
if any errors are thrown. The command line helps us debug any issues that
might arise. This example is a very simple example of a test case but in the
case of complex test cases, it is always easier to run from the command line.
• Example 3: Using the Maximize Command: In this example,
we look at the maximize command to maximize the browser
when opened.
The steps to follow are:
1. First, we create a new ruby file in the same location as before and
name it ‘maximize-window.rb.’
4. The automation executes the ruby commands and opens the URL
configured in the file using Google chrome. This window is then
maximized.
As seen from the content of the file above, we have a simple html page
with a label and button which is redirected to the page ‘anotherPageLink.
html’ when clicked.
The contents of the file ‘anotherPageLink.html’ are as follows:
136 Implementing Automated Software Testing
The test case we created is very simple. Let us go through it step by step.
The first step is a common step that is needed for all test cases to be
executed using ‘Waitr.’
The second statement is where we open the browser and save it in a
variable which we will be used in the further steps. Here, we choose to open
the default browser which is chrome.
The third statement is where we instruct that the html form be opened.
The fourth statement is where we provide the instruction to click on the
button and provide its id to watir. We make use of the ‘wait_until’ command
which waits until the given conditions become true (Watir Project – Waiting,
2009). The condition we give is that we wait until the button is present in the
browser form before clicking it.
Watir 139
In this test case, we open the html page, take a screenshot, then click on
the ‘Click me’ button and take a screenshot again before closing the browser.
We use the following command:
b.screehshot.save ‘filename.png’
The above command takes a screenshot and saves it in the current
repository with the file name provided.
4. We run the file using the command prompt.
The screenshots are created in the same location as the test cases:
142 Implementing Automated Software Testing
Watir 143
As seen from the form above, we have created a simple form with four
fields in a table separated by div tabs. A submit button is provided at the end
to submit the data. A second table is created to display the data. At the end,
we have a script element specifying the script to be used for the actions.
b. scriptOnClick.js:
Watir 145
146 Implementing Automated Software Testing
2. We proceed to open the html file in the browser and fill out the
form to check if it works.
We edit the Street address and age of the same user record.
We edit this file and create a watir test case that performs the same
actions for deleting a user as we did manually.
In this test case, we add to the previously created test case ‘personal-
test.rb.’ So, this new test consists of opening the form, adding a record, and
submitting it. We now add the steps to edit a record that is displayed in the
table. First, we click on the edit link using the ‘browser.link’ functionality.
After clicking the link, we proceed to edit some information in the user. As
we can see from the screenshot of the code above, we edit the fields Street
Address and age. We set the Street address to ‘Privet Drive Street’ and age
to 11.
152 Implementing Automated Software Testing
Note that here we use the command ‘ruby <filename.rb> to execute the
test case. This is an easier way of running ruby files.
The test case is executed as shown below:
Watir 153
Then, the ‘Edit’ link is clicked and the information pertaining to that
record is loaded in the form. The new changes are made in the form as
shown below:
154 Implementing Automated Software Testing
2. We then create a new test file in the same location as the html
form and name it ‘personal-form-delete-test.rb.’
156 Implementing Automated Software Testing
We edit this file in notepad and add the commands that would click on
the ‘Delete’ link. In this example, like the previous one, we build up on
the test case that we wrote previously. Thus, our new test case for testing
the deletion link consists of opening the page, entering a record, editing it,
saving it followed by the delete action.
This is shown below:
We make use of the browser.link command to check if the link exists and
then click on it. Then we confirm that we wish to delete the record. We have
added sleep commands throughout the test case to be able to slow down the
test and take screenshots.
Watir 157
The ‘OK’ button on the confirmation alert dialog is clicked and the
record is deleted successfully as shown below:
The test case is very similar to the previous example but here we click
on cancel instead of ok when the alert confirmation message pops up.
4. To run the test, we execute the ruby file from the command
prompt. This is shown below:
162 Implementing Automated Software Testing
The delete link for this record is clicked and the alert dialog pops up.
The data is then entered by the automation except for the ‘Age’ field.
Watir 167
As clear from the screenshot below, all fields except the ‘Age’ field are
filled in the form.
On submitting this incomplete form, we get the validation error for the
‘age’ field as follows:
Finally, a value is entered for this field and the record is created.
168 Implementing Automated Software Testing
Then, we edit the 2nd record by clicking on the edit link located at index
1. For watir, the indexes begin at 0 (Watir Project, 2017).
While editing, the ‘address’ field is left empty to test if the validation
error is thrown. The validation error is thrown as seen in the image below:
The last thing we do is to click on the delete link for the 2nd record and
then cancel the deletion request.
Watir 173
2. The next step is to create a test file. We create the test file in the
same location as before.
We edit this file and write the commands that we need to complete all
the actions we did manually.
The contents of this file are as follows:
174 Implementing Automated Software Testing
Then, the second record is edited, and the validation on the ‘address’
field is tested. We edit the 2nd record by providing the index in the ‘browser.
link’ command as follows:
browser.link(:text => /Edit/,:index => 1).click
In watir, the index begins at 0 (Watir Project, 2017).
178 Implementing Automated Software Testing
Once the validation for the ‘address’ field is tested, data is entered into
the address field and the record is updated. This is shown below:
Watir 179
Next, the automation tries to delete the 2nd record from the remaining
records. The alert confirmation dialog opens, and the automation cancels
this request.
180 Implementing Automated Software Testing
2. We edit this file using an html file editor to add the required html
and JavaScript code needed to display checkboxes and display
the selected values.
The contents of this file are as follows:
182 Implementing Automated Software Testing
3. We will now proceed to creating a ruby file and write our test case
using watir. Before that, we install the RubyMine IDE from the
JetBrains website: https://www.jetbrains.com/ruby/
We download the exe for windows and proceed with the setup.
Watir 183
184 Implementing Automated Software Testing
Once we reboot the system, we open the IDE. We accept the user
agreement and proceed.
Watir 185
When the IDE opens, the first thing you are asked to do is to activate your
account. Here, we start a free 30-day trial. RubyMine IDE is a commercially
licensed IDE (RubyMine: The Ruby on Rails IDE by JetBrains, 2022).
5. We edit this file to add a test case that tests the html form we
created in Step-1.
In this test case, we open the html page in the browser and then make
use of the checkbox command to select the checkboxes using the ids for
the checkbox values. Here, we select three options: orange, apple, and
watermelon.
6. We now run the test case by clicking on the run button at the top.
188 Implementing Automated Software Testing
The automation launches the browser and selects the checkboxes. Then
the submit button is clicked.
The test case is executed with success as seen in the screenshot above.
Watir 189
7. We can also unselect the values that we selected. This can be done
by using the watir command clear. The command is: browser.
checkbox(:id => ‘id’).clear
We apply this change in the checkbox-test.rb file as follows:
First, the three fruits Orange, Apple, and Watermelon are selected and
the submit button is pressed. This gives us the text saying that these fruits
have been selected.
190 Implementing Automated Software Testing
As clear from the screenshot above, the checkbox for ‘Watermelon’ has
been unselected.
Now, the submit button is pressed and the text changes to reflect the
checkboxes that are selected as shown below:
The test case is successful, which is also reflected in the console output
as follows:
CHAPTER 5
RANOREX STUDIO
CONTENTS
5.1. Setup and Installation...................................................................... 192
5.2. Ranorex Studio Basics...................................................................... 199
5.3. Examples......................................................................................... 201
192 Implementing Automated Software Testing
Follow the instructions provided in the README file. The first step is
to install the prerequisites.
Ranorex Studio 193
We click on ‘Next.’
Ranorex Studio 195
We then choose the features that we wish to install. Here, we select all
features. But you can choose the features you wish to install based on you
testing requirements.
For example, if the application that you are testing is never run-on
Firefox, then you can choose to omit the Firefox Add-on from the setup.
196 Implementing Automated Software Testing
5.2.1. Views
Ranorex Studio provides three important views (Ranorex, 2017).
1. Project View: This is a view that is common for most IDE’s
and it permits you to view all the files in the current project. The
project view is composed of the project, different libraries that
are used by the project and the application, the repository file,
modules, and all the files that are needed to execute the project.
The project view also permits working on multiple projects in a
single solution.
2. Module View: This displays the test steps and permits users to
execute single or multiple steps. A user can view the individual
test modules here. Different modules can be combined to create a
series of automated suites.
The module browser is made up of two types of folders. They are:
i. Groups: These are nothing but a collection of different items. All
the module groups are listed here.
ii. Modules: This section lists all the modules in the project.
This section lists all the recordings and the project’s code
files. Additionally, any variables that have been defined in the
recordings are found here as well.
The primary use of the module browser is to view the modules, drag-
drop the modules and automation groups and reuse them.
3. File View: The file view is shown when you double-click on a
file name in an open project from the Project View or the Module
View. If you double click on any file name, it is opened in the file
view much like any editor. For example, if you want to view the
recordings in more detail, you can double click on the recording
file, and it is displayed in File view. With the help of this view users
can display all the available files such as the This view displays
all the available files in the project such as the Recordings, the
repository, action tables, code modules, reports, etc.
200 Implementing Automated Software Testing
5.2.2. Components
The main components of the Ranorex Studio Tool are (Ranorex, 2017):
• Ranorex Recorder: It is a useful device that helps users record
the activities as test steps and providing interesting playback
and editing options. Different experiments can be done by
exploring the recordings, editing them, retesting, and fine-tuning
the recordings. The activities that are recorded can be adjusted
physically in the activity table, which is an interesting feature
provided by this tool. Ranorex is interesting in its design as the
activities recorded and the UI components related to the activities
performed are stored separately (different modules), which makes
it easier to perform changes and update the test cases.
Another useful feature of this tool is that users can record the actions
performed by the mouse in addition to allowing recording of the console.
This feature is very useful in the case of UI testing. Once these movements
are recorded, they are available for editing/updating in the Recorder activity
table, where you can perform a host of operations on the recordings. You are
allowed to adjust the test cases and your recordings to suit all your testing
needs. Although the Recorder is a device and can be used independently, it
can be easily coordinated with other components such the spy, the models,
etc.
• Ranorex Spy: It is a versatile test automation tool that is
beneficial for UI testing as it consists of an object recognition
tool. This tool is the Ranorex Spy. The Tanorex Spy is a tool that
is used for object recognition which helps locate and identify the
UI elements in the screen/website that is being tested (Peischel et
al., 2011).
The Ranorex Spy is like a scanner that locates and scans the UI elements
of an application. This helps in understanding the UI components of the
application that help in writing better test cases to test the application. It
permits analysis of the application from the UI viewpoint and allows the
ability to discern different elements of the UI with incredible ease (Peischel
et al., 2011). This scanning tool provides us with UI data mapping relative
to the XPath. We shall cover this in the upcoming sections. This tool helps
in creating tests/recordings that test the modules of the UI correctly. The
Ranorex Spy can see the details of the UI components of the application that
is under test, and it provides a hierarchical representation of the UI elements
which is extremely helpful when creating test cases.
Ranorex Studio 201
5.3. EXAMPLES
• Example 1: Creating Your First Test Case in Ranorex Studio:
In this example, we will create a test project in Ranorex Studio.
As this would be the first time that we open Ranorex Studio
202 Implementing Automated Software Testing
Here, we create a web project. We provide a name for the project and
choose the location for the project and click on ‘Continue.’
Ranorex Studio 203
The wizard then requests us to provide the URL that we wish to test and
the browser that we are going to use.
In this example, we use the URL provided by default and select ‘Chrome’
as the browser and click on ‘Continue.’
We are then prompted to choose if we wish to use whitelisting. In this
case, we do not use whitelisting.
204 Implementing Automated Software Testing
We click on ‘Continue.’
The test case summary provides details of the test case, such as the
status of the test case (Success/Failed/Blocked), the steps of the test case,
and details of the machine/system that ran the test case.
206 Implementing Automated Software Testing
In the project view, we can see that it contains the files of the Solution
– KeePass Test suite.
Ranorex Studio 207
As we can see clearly from the screenshot above, the items in the group
are display in file view. We can see that the Groups folder has two items, and
each item is comprised of two recordings. A recording file is indicated by the
small camera icon before the name of the file.
To better understand how the recordings, work, we need to see the
KeePassTestSuite.rxtst file as shown below:
As we can see from the screenshot above, each recording is part of test
case folder that is defined in this file.
In this sample solution, in the first folder/module of the test suite, each
test case is adding an entry to Keepass using different ways. The first test
case ‘AddEntryByRecording’ focuses on adding an entry via recording only.
The second test case ‘AddEntryByCodeModule’ adds an entry using the
code module file ‘AddCredentialEntry.’ The third test case tries to add entry
by providing arguments in the test case. The last part of this module is the
teardown where the Keepass data is saved and closed.
Each of these test cases in the first module, have three common types of
recordings: add entry, validate entry, and delete entry.
Let us take a brief look at each of these recordings in brief.
Ranorex Studio 209
The values displayed in the window above are the values that are entered
during the execution of the test.
The validateEntry recording is as follows:
First, a new entry is created using the variables declared in the ‘AddEntry’
recording.
Ranorex Studio 213
Once the entry is created, the automation deletes the entry and save the
database.
214 Implementing Automated Software Testing
Next, the automation logs in again and adds another entry using the
credentials file.
Ranorex Studio 215
Once the credentials are added and validated, the entry is deleted.
After the entry is deleted, the next part of the test suite is executed where
a new group is added after which the recycle bin is emptied.
216 Implementing Automated Software Testing
The items created are deleted and the keepass database is saved.
218 Implementing Automated Software Testing
The summary details the test suite and the test case that were executed as
part of the test suite. Additional details such as the execution time, machine
details, etc., are provided as well.
• Example 3: Create a Test Suite for a Desktop Calculator
Application: In this example, we download a sample calculator
application and create a test suite that records and tests its
functionality.
The steps followed are:
1. We download a sample calculator application from the following
website: https://basic-calculator.en.softonic.com/
2. Once the calculator application is downloaded, we navigate to the
downloads folder and launch it.
Ranorex Studio 219
3.
Once we have checked that the application works fine, we close it
and proceed to create a new solution in Ranorex Studio. We first
open Ranorex Studio.
We navigate to File → New → Solution Wizard to create a new solution.
The above window asks us to choose the application that we would like
to test. We go to ‘Browse for application’ tab.
We click on finish to complete the wizard and create the new solution.
The solution is created and when its opened and the calculator application
is launched with the solution as shown below:
By default, the test suite is created with a test case that has a setup, an
empty recording, and a teardown section.
We click on ‘Recording1’ and navigate to the recording1.rxrec file and
can begin recording for the test suite.
10. To begin recording for the test case, we click on the record button.
The record window is displayed in the corner of the screen along with
the calculator application in the center as shown below:
226 Implementing Automated Software Testing
Once we are done with our recording, we can see that the file ‘Recording1.
Rxrec’ is now updated with the actions that we recorded.
As we can see from the screenshot above, each movement has been
recorded.
228 Implementing Automated Software Testing
11.The last step would be to execute the test suite containing the
updated recording.
We click on the green run button at the top to execute the test suite.
The test suite launches and goes on to repeat the actions that we
performed earlier.
We proceed to create a simple shape in the application and save the file
as ‘test.bmp.’ The Ranorex recorder located at the right-hand bottom corner
of the screen starts recording our actions.
We run the test suite by click on the play icon located in the toolbar at
the top.
As visible from the screenshot above, the test suite runs successfully.
• Example 5: Creating a Test Suite for a Demo Website: In this
example, we shall create a test solution for a web application.
We create a Ranorex solution for an online demo web application using
their solution creation wizard and create a test suite for it.
The steps are as follows:
1. We first access a demo website available online. For this exercise,
we go to a sample demo website provided by SwagLabs: https://
www.saucedemo.com/ (Swag Labs, 2022).
2. We open the application and login to the demo application using
one of the accepted usernames and the password.
11. We proceed to execute the test suite with the test case that we just
recorded clicking on the run button (green play icon) at the top.
244 Implementing Automated Software Testing
As seen from the test results summary above, the test suite is executed
successfully.
12.Now, we proceed to create a new test case that runs the scenario
of an incorrect or locked out user login. In this test case, we will
try to login using a username that is ‘locked out’ of the demo
system and cannot login in.
To create a new test case, we go to the Projects tab, right click on the
WebSolution project name, and go to Add → New Item.
The Add new item dialog appears and we choose ‘Recording module.’
Note that the Ranorex recorder appears in the right-hand bottom corner
and starts recording every action that we do on the application under test.
We login using the test username that fails on login, which is the
‘locked_out_user’ and the password ‘secret_sauce.’
When we click on the ‘LOGIN’ button, we get an error saying that user
has been locked out.
16. We now proceed to add this newly created recording to a new test
case which is added to the test suite.
This is done as follows:
First, we navigate to the test suite file and click on ‘Add’ and then go to
‘New Test Case.’
As clearly visible from the screenshot above, the new test case ‘Incorrect_
Login_Test’ now has a setup and teardown module.
250 Implementing Automated Software Testing
We click on ‘OK’ to add the recording to the newly created test case.
As can be seen in the image below, the newly created test case now has
Recording2 in it.
Now that we have completed the second test case, we save the test suite
file and execute it by clicking on the play icon located in the toolbar.
As can be seen from the results above, the test suite containing the
following two test cases has been executed with success:
• Opening the demo website, logging in and clicking on an item to
view its details; and
• Opening the demo website and logging in with a locked-out user.
17. As the name of the first test case is not very meaningful and does
not accurately describe the test case, we update its name and
description and then re-run the test suite.
252 Implementing Automated Software Testing
Ranorex Studio 253
9. Bangare, S. L., Borse, S., Bangare, P. S., & Nandedkar, S., (2012).
Automated API testing approach. International Journal of Engineering
Science and Technology, 4(2).
10. Beizer, B., (1995). Black-Box Testing: Techniques for Functional
Testing of Software and Systems. John Wiley & Sons, Inc.
11. Beizer, B., (2003). Software Testing Techniques. Dreamtech Press.
12. Collins, E., Dias-Neto, A., & De Lucena, Jr. V. F., (2012). Strategies for
agile software testing automation: An industrial experience. In: 2012
IEEE 36th Annual Computer Software and Applications Conference
Workshops (pp. 440–445). IEEE.
13. Create Your First Test, (2022). https://docs.katalon.com. https://docs.
katalon.com/katalon-recorder/docs/automate-scenarios.html (accessed
on 24 March 2022).
14. Cross Browser Automation Testing Using Watir, (2019). LambdaTest.
https://www.lambdatest.com/blog/cross-browser-automation-testing-
using-watir/ (accessed on 24 March 2022).
15. Dustin, E., Rashka, J., & Paul, J., (1999). Automated Software Testing:
Introduction, Management, and Performance. Addison-Wesley
Professional.
16. Ereiz, Z., (2019). Automating web application testing using katalon
studio. Zbornik Radova Međunarodne Naučne Konferencije o
Digitalnoj Ekonomiji DIEC, 2(2), 87–97.
17. Groover, M. P., (2020). Automation. Encyclopedia Britannica. https://
www.britannica.com/technology/automation (accessed on 24 March
2022).
18. https://docs.katalon.com. (2022). [WS] Send Request. [online]
Available at: https://docs.katalon.com/katalon-studio/docs/ws-send-
request.html#returns (accessed on 24 March 2022).
19. Humble, J., & Farley, D., (2010). Continuous Delivery: Reliable
Software Releases Through Build, Test, and Deployment Automation.
Pearson Education.
20. Introduction to Custom Keywords, (2022). https://Docs.katalon.com.
https://docs.katalon.com/katalon-studio/docs/introduction-to-custom-
keywords.html#create-a-package (accessed on 24 March 2022).
21. Joy, B., Steele, G., Gosling, J., & Bracha, G., (2000). The Java
Language Specification.
Bibliography 257
A C
Acceptance testing 20 calculator application 218, 222,
AddEntry recording 209, 210 224, 225
address field 178 chrome browser 120, 157
Agile delivery process 10 chromedriver 119, 120, 122
API request 50, 59, 76, 81 ChromeDriver website 120
Application Programming Interface chrome web page 123
(API) 22 code 26, 35, 36, 50
Application Programming Interface CodeModules 207
(API) Testing 22 coding languages 192
authorization 32, 49 command line 129, 132, 133, 139,
Automated software testing 10 148, 157
Automated testing 10, 11 command prompt 117, 127, 133,
Automatic program testing 11 141, 152, 161, 165, 174
Automation 10, 12, 14, 15, 16, 17 confirmation alert dialog 159
automation logs 214 Contains String 57, 58, 61, 62
Automation testing 2 Continue evaluation 198
Automation tool 10, 14, 24 Continuous delivery model 10
Automobile industry 10 credentials 214, 215
credentials file 214
B cross-browser testing 192
browser driver 119 crud actions 168
business email 192 Customer satisfaction 3, 5
Customer’s confidence 6
custom keyword 98, 103
260 Implementing Automated Software Testing
D getUsers 54, 58
getUsersResponse 56, 58, 68
data-driven testing 192
Google chrome 130, 134
Delete 154, 156, 159, 179
google search bar 106
deleteEntry recording 210
google search page 130
delete link 154, 158, 163, 172, 179
demonstration 37, 38 H
Desktop 206, 218, 220, 229
header 32, 33
desktop applications 192
headers tab 33
Desktop Automated Tests 26
Help menu 38
E html 50, 103
HTTP header tab 32
Edge 112, 124, 125, 129, 130
Edge browser 239 I
Edit 114, 149, 153, 177
icon 205, 208, 211, 237, 243, 251
edited record 158
Input 67, 71, 72, 90, 91, 96
Element Property Value 70, 73, 78,
Input dialog 67
80, 95
Input Window 71
email address 192
installation 26, 29, 114, 117, 120,
empty 146, 164, 170
124, 126
endpoint 31, 74
installation process 197
End User License Agreement 195
Integration test 18
entry 53, 54, 55, 57, 58, 67, 68, 71,
Intercom Chat window 205
72, 79, 80, 91, 92, 94, 96, 108
Internet Explorer 112
error message 164
execute 33, 35, 58, 59, 60, 62, 65, J
82, 86, 87
Java 192
execution time 218
JavaScript 50
Existing module 250
JSONPlaceHolder 50
expectedStatusCode 56, 91
JSON property 71
F
K
File view 199
katalon.exe 29
Financial markets 4
Katalon Studio 25, 26, 27, 28, 30,
Firefox 105, 112
38, 66, 70, 75, 81, 82, 84, 98,
Functional testing 16, 20
101, 103
G Keepass data 208
keepass database 217
gems 117, 118, 127
keyword-driven testing 192
Get Element Property Value 70
Index 261
Keywords 52, 98 P
L package 29, 98, 99, 100, 101
paint application 229, 230, 233
Leanne Graham 42, 58
parallel testing 192
Load New Content 86
parameters 33, 52, 58, 62, 71, 91,
Load Service Function 84, 85
96, 103
locator parameter 71, 81
Performance test 20
log viewer section 36
Personal Information Form 143
Log Viewer tab 59
pre-defined link 37
M PrintHello 90
Privet Drive Street 151
machine details 218
program 35, 52
Manually repeating tests 11
project 30, 38, 39, 40, 48, 59, 64,
Manual testing 2
100
Microsoft 124, 125, 126, 130, 136
Project Section 50
Mobile 26, 103
Project View 199
mobile applications 192
module browser 199, 207, 209 Q
Module View 199
Quick Guide menu 38
MSI installer package 193
Quick Guide screen 30
multiple records 168
R
N
Ranorex Recorder 200, 201, 226
New entry 52
Ranorex repository 201
New Web Service Keyword 66
Ranorex Spy 200, 201
Non-functional parameters 17
Ranorex Studio 191, 192, 197, 198,
Non-functional tests 17
199, 200, 201, 204, 206, 220,
O 229, 238
Ranorex Test Suite Runner 201
Object 54, 59, 75, 82, 107, 108
Ranorex website 192
object-oriented programming 106
Recorder 200
object-oriented scripting language
Recorder activity table 200
Ruby 125
Record Web 104
official website 114
record window 225
OpenApi2 36
recycle bin 215, 217
Open-source library 112
regression testing 192
operation 86
Regression testing 16, 17, 19, 24
Output 54, 80
Request message 86
262 Implementing Automated Software Testing
responseObject 56, 91 T
ResponseObject parameter 58
tab 34, 36, 77, 85, 88
returned data 71
Tanorex Spy 200
Rigorous testing 4
TDD (test driven development) 17
Ruby 112, 114, 118, 120, 125, 185
teardown module 240, 249
Ruby code 112, 118
test1.rb file content 131
ruby file 127, 133, 137, 150, 161,
Test automation 10, 11
174, 175, 182
Test case 30, 34, 36, 50, 51, 52, 53,
Ruby interpreter 112
54, 55, 58, 59, 60, 61, 62, 63,
Ruby Interpreter 114
66, 67, 69, 70, 71, 72, 73, 77,
Ruby language 112, 114
78, 79, 80, 82, 88, 89, 94, 95,
S 96, 97, 102, 103, 104, 107,
108, 109
Safari 112
test/dummy data 38
screen 33, 36, 58, 59
Test parameters 52
screenshot 33, 35, 37, 54, 60, 68,
Tests Explorer 98
70, 73, 87, 88, 90, 93, 96, 100,
test suite 34, 35, 36, 59, 63, 64, 65,
103
66
script view 35
toolbar 205, 211, 237, 251
Security tests 19
Select Test Module 250 U
selenium web driver 119
Unit testing 16, 17, 22
Send request 89
useRegex 58
Send Request 53, 61, 78, 79, 91
User interface (UI) 18
Service Endpoint 87
Smoke Test 18 V
Software community 2
validateEntry recording 210
Software development life cycle 2
validation errors 166
Software product 3, 4, 5, 6, 7
variable 54, 56, 58, 68, 71, 78, 80,
Software system 2, 4, 6
89, 90, 91, 93
Software Testing 1, 2
Verify Element Property Value 73,
source files 36
78, 80
standalone applications 192
Verify Elements Count 66, 67
StartAndLogin 207
Verify Element Text 92
straightforward 114
verify response status code 55
Street address 150, 151
Sublime Text 143 W
Submit 147, 154, 166
Supplementary costs 12 Watir 111, 112, 114, 118, 122, 123,
125, 126, 129, 130, 135, 138,
Index 263
139, 143, 149, 159, 170, 177 Web Service Keywords 52, 55, 57
watir package 118 web services 38, 44, 84
watir test 119, 151, 180 Web solution 238
web 38, 39, 44, 54, 55, 57, 66, 73, whitelisting 203, 239
77, 80, 82, 83, 84, 85, 88, 89, window 37, 40, 50, 51, 63, 64, 82,
90, 92, 93 83
web applications 192 windows machine 114
Web Application Testing 112 wizard 202, 203, 223, 224, 229, 237
web browser 112, 120, 130
X
Web Browser 104
webdriver 119, 124 XML 50
Web Record Dialog 106
Z
web server 53
Web Service keywords 53 zip file 192