End to End Automation of Flight Application in Robot Framework

An end to end Automation framework includes a complete agile test approach. The following are the steps to follow:

  • Collecting the requirements from the Business Analyst
  • Understanding the test case flow and the keywords for automation
  • Understanding the positive and negative scenarios of these test cases.
  • Creating a sample manual test case
  • Converting the collected requirements to Epics-->User stories-->Test cases
  • Starting automation for all the test cases which include Data-driven and Keyword-driven approach

Brief Introduction about Agile methodology in Robot Framework

AGILE methodology is a practice that promotes continuous iteration of development and testing throughout the software development lifecycle of the project. Both development and testing activities are concurrent at the beginning itself

The Characteristics of Agile Methodology are
  • Speed up or bypass one or more life cycle phases
  • Usually less formal and reduced scope
  • Used for time-critical applications
  • Used in organizations that employ disciplined methods
Principles of Agile Methodology
  • Working software is the primary measure of progress.
  • Agile processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely.
  • Continuous attention to technical excellence and good design enhances agility.
  • Simplicity the art of maximizing the amount of work not done is essential.
  • The best architectures, requirements, and designs emerge from self- organizing teams.
  • At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.
  • Our highest priority is to satisfy the customer through early and continuous delivery of valuable software.
  • Welcome changing requirements, even late in development. Agile processes harness change for the customer's competitive advantage.
  • Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale.
  • The most efficient and effective method of conveying information to and within a development team is a face-to-face conversation.
Advantages of Agile Methodology
  • The Agile methodology makes it easier to add features and functionality throughout the project
  • Program/module rewrites are expected as part of the project process to align to changing requirements
  • Project / “Sprint” priorities are assessed frequently
  • Communication is high on an Agile touchpoint (particularly SCRUM) due to daily touchpoints
  • Requirements are refined throughout the project as each sprint is completed to ensure the end product addresses the business need.
  • The testing at the end of each sprint ensures that bugs/defects are found early on in the process.
  • As a result of testing within the “Sprint,” the product can be launched anytime after a “Sprint”.

Installation of Selenium Library

Some of the Agile Methodologies in Robot Framework

  • Adaptive Software Development (ASD)
  • Feature Driven Development (FDD)
  • Crystal Clear
  • Dynamic Software Development Method (DSDM)
  • Rapid Application Development (RAD)
  • Scrum
  • Extreme Programming (XP)
  • Rational Unify Process (RUP)

The Agile Methodology is divided into sprints, and each sprint is considered as Iterations, Each iteration has it's testing phase and development phase.

The user in the sprint gets a user story, and he develops the logic functionality, it is considered as very small functionality like Login functionality, he develops login functionality and sends it to the tester to test it. Now, the tester in the same sprint will test the functionality, and if is there any issues, then he will send it back to the developer.

In the flight application, we have four epics such as
  • Epic-Login
  • Epic-Manage booking
  • Epic-Search Flight
  • Epic-check in
  • Epic-Logout

An Epic is a big chank of work that has one common objective, and it can be a feature, it can be a customer request or the business requirement. All these epics have one common requirement that is login. Each epic usually takes one sprint to complete.

end-to-robot-framework-automation

Each Epic is Further divided into a user story. All these Epics and User stories are first to come from the business, so the business user has to test Login functionality, Manage Booking, Search Flight, and Logout functionality.

Each of these user stories has its own acceptance criteria. The acceptance criteria are nothing, but, there are certain conditions. If this condition is true, then we can say that the user story is complete.

Manages Booking Test Scenarios

Writing a Manual Test Case in Robot Framework

Below are the steps to follow while writing a sample manual test case:

Test Case Name Test Steps Description Expected Result
Book a flight-Round trip between To and From destination Step-1 Open a browser and enter the URL <ngendigital.com/demo-application> Flight application Login page will be displayed
Step-2

Enter [email protected] and password-abc123

Click on Sign in

Flight application Homepage is displayed. Verify the page contains the Title-Book Your flight and a tab displaying four links-search flights, Manage Booking, Check-in, and Logout
Step-3 Click on the Link Manage Booking Manage booking tab is displayed. It contains From and to destination. Start and Return Dates. checkbox for the Round trip, and Radio Buttons for Flight and Flight+Hotel
Step-4 Choose From-Toronto, To-Atlanta, start Date-2019/06/21, Return Date-2019/06/28. Check Round Trip and choose Flight radio button.click on getting Fare A table was displaying the Fare for the combination of the following Start and Return Dates. Start dates--19-jun,20-jun,21-jun,22-jun,23-jun,24-jun,25-jun,26-jun,27-jun,28-jun,29-jun,30-jun.
Step-5 Click on Confirm Booking

The flight will be booked displaying the Message.-SUCCESS!! Your flight is booked.

Step-6 Click on Logout The user is logged out. Verify the Login page is displayed.
Step-7 Close Browser Browser is closed

Database Library in Robot Framework

The Test Case Flow and Keywords for Automation in Robot Framework

test-case-flow-chart

Open the ngendigital page, and click on the demo application, log in to flight application page will open. Enter the required credentials, username:[email protected], and password: abc123 and click on Sign In.

login-to-flight-application-pge

Once you logged in, Book your Flight page will open, there you can see, Search Flight, Manage Booking, check-in, and Log out options will be there.

book-your-flight-page

Click on the Manage Booking and fill the required credentials

manage-booking-select-get-fare

Select the Flight or Flight + Hotel and click on Get Fare you will see the fare details, select any one of them and click on the Confirm Booking.

get-fare-and-confirm-booking

Once you click on to Confirm booking, a message will be displayed as shown below

success-your-flight-is-booked-message

Automation of Desktop Application Using Robot Framework

Login Test Cases in Robot Framework

We have seen that the Epic-login is having three user stories such as Login Existing User, Login New User Signup, Login Forgot Password.

First Test Case:

Lets start working on Epic-Login And see how many test cases we can generate from the user story. The Login-story is having two main scenarios like Static validation and Client-Side Validation and Positive Test Case.

The static validation means it verifies whether the object is present on the login page or not. It is totally having six test cases. Let us go through our first test case.

Test Scenario Test Case Name Test Steps Description Expected Result
Static validation and Client-side validation TC01-Login screen-Objects on the page Step-1 Open the browser and enter the URL <www.ngendigital.com/demo-application> The flight application login page will be displayed. Verify the page contains a box containing the title-My Account And containing two text boxes for Username and Password, and two buttons sign in and signup. The page contains a link for forgot password and displays the text. Forgot your password..? Click here.

That means when you hit the URL in the web page, it should display the Flight application login page which contains My Account with email and passwords keys as shown below

Login-page-of-tc1

We have to verify each and everything, which means the page should contain email, password, sign In and sign Up button over there or not.

Open the Ride editor and create a new test suite as Flight Application and then create our first test case as TC01-Login screen-Objects on the page.

tc01-testcase-logib-screen-objects

Now create a new Resource File as Commonkeywords

create-new-resource-coomonkeywords

Create a new keyword as Loginandnavigatetourl

new-resource-keyword

Go back to commonkeywords and import the SeleniumLibrary and go to Loginandnavigatetourl keyword and create a link as shown below

create-a-link-in-naviagte-to-url

Now, go to Flight application1 the test suite and import the resource file and then go to our first test case TC01 and enter the keyword asLognandnavigatetourl, here you need not provide the URL and the browser name because we have created a new keyword that contains URL and the browser name.

writing-firts-step-in-the-tc01-test-case

This is all about the first step.

Navigate to the Flight application page and right-click on the My Account and Inspect. Try to find whether the element is unique or not by writing the Xpath for My Account.

xpath-for-my-accountt

Now go back to the commonkeywords and create another one user-defined keyword as a change to iframe and give credentials inside the change to the iframe as shown below

craete-user-defined-keyword-change-to-iframe

And another one user-defined keyword as Objectonwebpage.

new-user-defined-keyword-object-on-webpage

Enter the credentials inside the Objectonwebpage as shown below

entering-credentials-in-object-on-web-page

And then, go back to the ngendigital page and on the Login page that contains another two elements such as email and password. Inspect these two elements and try to write the XPath for the same.

write-xpath-for-email-and-password

The next condition is to verify the element sign in and sign up keywords and write the XPath for the same. In the same way, write the Xpath for the Click here and the Forgot your Password element as well.

Navigate to the Ngendigital/Dem-application page and right-click on Click Here! and inspect the element and then find the Xpath for the same.

inspecting-click-here-robot-framework

Inspect Forgot your password? as shown below

inspceting-forgot-password-robot-framework

Create a new test case Objectonwebpage

objects-on-web-page-robot-framework

Now, we have three user-defined keywords, go to your test case and enter all the tree user-defined keywords. Save the test case and select and run the test case. In this way, you can simplify writing a test case.

simplified-test-case

Second Test Case:

Test Scenario Test Case Name Test Steps Description Expected result
Static Validation and Client-side validation TC02_Login screen-default text for username and password step1 Open a browser and enter the URL <www.ngendigital.com/demo-application> Flight application Login page will be displayed. Verify the username field contains the text-Email, and password text is masked.

That means when you navigate to the ngendigital.com/demo-application page, you can see that the email and password attribute values are masked over here, and hence, you need to verify that whether the attribute is containing the values email and password.

Right-click on the email and inspect the element and write the XPath for the same.

attributes-and-there-values

In the above image, you can observe that value is an attribute and it contains the value as email and the password. Go back to your Ride editor and create another one user-defined keyword in the commonkeywords as Defaultvalueusernamepassword and give the credentials, as shown below.

default-username-and-password

Now, create a new test case TC02_Login screen-default text for username and password

creating-tc02-test-case

And write the test case as shown below and save, then run the test case.

tc02-complete-test-case

Once it starts executing the test case, it will verify the attribute values, and hence the log report is

tc02-log-report-robot-framework

Thirst Test Case:

Let us move on to the third test case

Test case Scenario Test Case Name Test Steps Description Expected Result
Static validation and client-side validation TC03_User doesn't enter email

Step1

Open the browser and enter the URL <ngendigital.com/demo-applicattion> Flight application Login page will be displayed
Step2

Delete email and enter password-abc123.

Click sign in

System Displays-please enter the username

When we navigate to the ngendigital practice page and open the demo application, you will see email and password has been masked, just remove email and enter the password as abc123 and click on sign in, the system will immediately display a message as please enter the username

please-enter-the-username

Inspect the Login to Flight Application and then write the Xpath for the same and go back to the ride editor and enter the locator Xpath in the Loginandnavigatetourl user-defined key to verify every time you log in to the flight application.

update-login-and-navigate-to-url

And, create a new user-defined keyword for the second part(clearing the text email), first create a new user keyword as EmptyUsername write scripts for clearing the email and then entering the password and then click on the Sign-in button and the last one verifying whether the test please enter username is present or not.

Inspect the element please enter username and write the XPath for the same and mention that in the user-defined keyword in case of getting the text.

xpath-for-enter-user-name

Before that create new scalar variables as shown below

creating-new-scalar-variable

Now, go back to Emptyusername and use this scalar variable

empty-username-keyword

Now, create a new test case as TC03_User doesn't enter email

tc03-test-case

Select the test case and run, once the test case starts executing, Opens the ngendigital page and clears the email and then enter the password and displays the message please enter username

clears-the-email

diplay-the-message-please-enter-the-username-robot-framework

And the log report is:

log-report-of-tc03-robot-framework

Fourth Test case:

The fourth test case is a negative test case. Let us see the details below :

Test Case Scenario Test Case Name Test Steps Description Expected Result
Static validation and client-side validation TC04-User doesn't enter Password Step-1 Open a browser and enter the URL <www.ngendigital.com/demo-application> Flight application Login page will be displayed
Step-2 Enter [email protected] and delete the password. Click on Sign In System Displays -please enter password

Navigate to the ngendigital practice page, enter the email and delete the password, as soon as you click on the Sign In. The system will display the message as Please Enter Password.

system-displaying-message

Right-click on please enter the password and inspect the element and then write the Xpath for the same.

writing-xpath-for-enter-password

Now, go back to the ride editor and create a new user keyword as Emptypassword

new-user-key-word-empty-password

And, create a new test case as TC04-User doesn't enter Password and write the test scripts.

tc04-test-case

Now, select the test case and run, Once it starts executing, the ngendigital.com/demo-application the page will open, and it enters the Email and delete the password and click on Sign In and then displays the message please enter the password.

The Log report is:

log-report-of-tc04-robot-framework

Fifth Test Case:

In this test case, we are going to deal with deleting both email and the password.

Test Case Scenario Test Case Name Test Step Description Expected Result
Static validation and client-side validation TC05_User doesn't enter email or password step-1 Open a browser and enter the URL <www.ngendigital.com/demo-application> Flight Application Login page will be displayed
Step-2 Delete Email and Password. Click on Sign In System displays, please enter username and password

In every test case, I am first executing the test scenario manually and then executing it automatically by writing the test case.

First, navigate to the ngendigital page and then delete the email and password and click on the Sign In. The system will display the message. Please enter the username and password.

system-displying-message-plese-enter-username-and-password-manually-robot-framework

Right-click on the please enter username and password and inspect the element and then write the test case for the same.

xpath-for-username-and-password

Now, create a new user-defined keyword as emptyusernamepassword

empty-username-and-passowrd

Now create a new test case as TC05_User doesn't enter email or password

tc05-test-case

Select the test case and run, once the test case starts executing, the ngendigital the page will open, and it will clear the email and password and then click on the Sign In button and finally displays the message as please enter username and password.

The log report is:

log-report-of-tc05-robot-framework

Sixth Test Case:

In this test case, we are dealing with when the user enters the email in the wrong format.

Test Case Scenario Test Case Name Test Steps Description Expected Result
Static validation and client-side validation TC06_User enters invalid email formats Step-1 Open the browser and enter the URL <ngendigital.com/demo-application> Flight application login page will be displayed

Step-2

Enter support*ngendigirtal.com and password as abc123 and click Sign In Invalid email format message will be displayed on the screen

Navigate to the ngendigital practice page and then enter the username as support*ngendigital.com and the password as abc123 and click on Sign In, then the Invalid email format message will be displayed on the screen.

invalid-email-format-message

Right-click on the Invalid username/password and inspect the element and then write the Xpath for the same.

xpath-for-inavlid-login

Go back to Ride editor and then create a new user-defined keyword as Invalidusernamepassword

invalid-username-and-password

Now, create a new test case as TC06_User enters invalid email formats

tc06-test-case

Now, select the test case and run, once the robot framework starts executing the test case, it will open the ngendigital/demo-application and then it enters the username and password and click on the Sign In button and then displays the message as Invalid username/password.

The Log report of the test case is:

log-report-of-tc06

GitHub with Robot Framework Flight Application

Data-Driven Test Case in Robot Framework

DataDriver is an alternative approach to create Data-Driven Tests with the Robot Framework. DataDriver creates multiple test cases based on a test template and data content of a CSV or Excel file. All created tests share the same test sequence (keywords) and differ in the test data. Because these tests are built on runtime, only the template has to be specified within the robot test specification, and the user data are specified in an external data file.

In this Test case, we are creating a generalized function by the name LoadExcelData, In this, we have to provide the name of the sheet and Name of the test case we have to provide the column name. By using these values, we will get data from the excel file.

We have to create an Excel file, as shown below:

created-prac-xls

And we have to create a new resource file and some scalar variables as shown below:

new-resource-scalar-variables

Creating a new user-defined keyword by the name Get data from Excel with the given column

user-defined-keyword-get-data-from-excel-with-given-column

The complete keywords of the resource file are as below :

Get data from Excel with the given column

[Arguments]   ${ssheetname}    ${stestcaseNo}    ${sColumnname}

log    ${sColumnname}

${columncount}    Get Column Count    ${ssheetname}

log    ${columncount}

: FOR    ${y}    IN RANGE    0    ${columncount}

${Header}    Read Cell Data By Coordinates    ${ssheetname}    ${y}    0

Run Keyword If    '${Header}'=='${sColumnname}'    Set Test Variable    ${Columnnum}    ${y}

Log    ${Columnnum}

${itotalrows}    ExcelLibrary.Get Row Count    ${ssheetname}

: FOR    ${irownumber}    IN RANGE    1    ${itotalrows}+1

${TC_Num}    Read Cell Data By Coordinates    ${ssheetname}    0    ${irownumber}

${Ssearcheddata}    Run Keyword If    "${stestcaseNo}"=="${TC_Num}"    ExcelLibrary.Read Cell Data By Coordinates    ${ssheetname}    ${Columnnum}  

${irownumber}

Run Keyword If    "${stestcaseNo}"=="${TC_Num}"    Exit For Loop

[Return]  ${Ssearcheddata}

Now, creating another one user-defined keyword Load Excel Data as follow:

Load-excel-data

Open the TC07 test case and write the data as follow:

tc07-test-case

Once I run the tets case, I am getting the following error

sheet1-not-in-list-error

Try to follow the same steps as shown above and execute it.

Seventh Test Case:

Test Case Scenario Test Case Name Test steps Description Expected Result
Positive Test case TC07_User Login with Valid username and password Step-1 Open the browser and enter the URL Flight application demo page will be displayed
Step-2

Enter [email protected] and password-abc123.

Click on Sign In

The page contains a tab, containing four links Search Flight, Manage Booking, Check-In, Logout

First, let us do this manually, navigate to the URL ngendigital/demo-application and enter email and password and click on Sign In Once you logged in, the flight application login page will be displayed. It contains four tabs, such as Search Flight, Manage Booking, Check-In, and Logout.

four-tabs-page

As soon as you clicked on the Logout button The Login page will be displayed. Go back to the ride editor and create a new test case by the name TC07_User Login with Valid username and password

And go to Commonkeywords and import the ExcelDataFetch resource file into it and create a new user keyword by the name Login and copy the first three lines of data from the Emptyusername and paste it into Login and create two scalar variables, username, and password and insert them into the Login keyword.

login-keyword

Now go to the prac.xls file and enter the following

updated-prac-xls

Now, go to the test case and enter the new user keyword Login and run the test case

test acse-tc07

And the next thing is that we have to verify that, after you log in the page displays tab containing four-link Serch Flights, Manage Booking, Check-In, and Logout. Let us first do this manually.

Navigate to the ngendigital/demo-application Page and log in with the username and password, and you will see a page containing four tabs. Now, right-click on the search flight and inspect the element and write the XPath for the same

xpath-for-search-flight

And in the same way, we have to find the Xpath for all the remaining tab. Go back to the ride editor and create another commonkeyword as verifyafterlogin and write the data into it.

verify-login-keyword

Enter this keyword in the test case and run

Installation of Selenium Library

Problem Faced:

while working with Data-driven test case, I have created the user-defined keywords Get data from Excel with the given column as shown in this article, when I run the test case TC07, I am getting an error as no sheet named <u' '>, you guys please work on this, if anyone got the solution for this issue please comment on it.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions
  • Sourabh
    Hi,
    For me it worked!
    Reply
  • Subscribe to See Videos

    Subscribe to my Youtube channel for new videos : Subscribe Now