0% found this document useful (0 votes)
32 views

Cpe 310 Software Engineering - Week - 13 - English - Automated Testing

Uploaded by

sagmurat24
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Cpe 310 Software Engineering - Week - 13 - English - Automated Testing

Uploaded by

sagmurat24
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

CPE 310 SOFTWARE ENGINEERING

Spring Semester-2021
Dr. Nesrin AYDIN ATASOY
Week 13: Automated Testing

Automated tests use software to perform tasks without the manual instruction of a tester.

In manual testing, the tester will write the code they want to execute or plan the software
path they want to check is working properly. Automated tests take care of such things on the
testers behalf. Here’s a quick list of automated software and QA tools that QA analysts
should know:

 Selenium
 Cucumber
 Katalon Studio

1. Selenium

Selenium is an open source, flexible library used to automate the testing of Web applications.
Selenium test scripts can be written in different programming languages such as Java, Python,
C# and many more. These test scripts can run on various browsers like Chrome, Safari,
Firefox, Opera and support various platforms like Windows, Mac OS, Linux, Solaris.

Selenium is mainly for automating web applications for testing purposes, but certainly not
limited to that. It allows you to open a browser of your choice and perform tasks like a human
would. For example:

• Clicking the buttons


• Entering forms

• Searching for specific information on web pages

• Extracting required data

It should be noted that data scraping with libraries like Selenium is against most sites' terms of
service. If you pull data too often or maliciously, your IP address may be banned from that
web page.

1.1. Selenium Tools

 Selenium IDE

Selenium IDE (Integrated Development Environment) is a Firefox extension. It is one of the


simplest frameworks in Selenium Suite. It allows us to save and play scripts. If you want to
create scripts and write more advanced and robust test cases using Selenium IDE, you should
use Selenium RC or Selenium WebDriver.

You can download it by clicking the link http://docs.seleniumhq.org/download/.

Features of Selenium IDE are as follows:

• It behaves like a normal user and processes and saves accordingly.

• Can be used to write functional tests.

• It works as a Firefox plug-in.

• Support for many languages (Java, .NET, Python, Ruby, PHP, Perl)

• Thanks to Selenium being open source, it works on many platforms (Windows, Linux, IOS)
without any problems.

• It is preferred more than other test tools thanks to its multi-language and platform support.
(UFT, QTP)

 Selenium RC

Selenium RC is developed for writing web application testing in different programming


languages. It is a QA to automate UI tests for web applications against any HTTP website or a
testing framework that allows a developer to write test cases in any programming language.
Selenium RC is the answer to a more powerful test suite for your applications. It follows a
client/server model that allows client libraries to run tests in a server-controlled browser.
Today, Selenium RC is officially deprecated.
 Selenium WebDriver

Selenium WebDriver is a browser automation framework that accepts commands and sends
them to a browser. It is implemented via a scanner-specific driver. It communicates directly
with the scanner and controls it. Selenium WebDriver supports various programming
languages such as Java, C#, PHP, Perl and JavaScript.
For example, you need to test whether the comment form on the bottom page of a site you are
going to test works. For this, we first enter the site and in the next step we come to the part
where the comment form is located at the bottom of the page with scroll. But Selenium cannot
give us the scroll operation as a code output. This is where WebDriver's libertarian structure
comes into play. It enables us to make our test cases more workable and controllable by using
WebDriver elements.

 Selenium Grid

Selenium Grid is a tool used with Selenium RC. It is used to run tests on different machines in
parallel with different browsers.

Selenium-Grid, which has been developed and continues to be developed by Selenium, runs

on different servers in parallel with different browsers. The main purpose here is to see test

results on combinations such as different operating systems, hardware, devices, to run test

processes in parallel in a distributed environment and to get test results quickly. When these

tests run in parallel, there is a serious time saving in terms of time.

It tests using Selenium Hub and Node structure.

Hub: The Hub used in Selenium works on the condition that there is only one. This structure,

which acts as a server, hosts many processes on itself, and you can test the same code on

different platforms and browsers by responding to requests from different clients.


Node: The structure consisting of one or more clients connected to the hub is called a node.

You can test with Nodes by making requests from many Nodes to a single Hub using

selenium-grid.

1.2. Web Applications Test Methods

Web application tests can be examined with 8 different methods:

• Functional Test

• Session and Cookie Test

• Database Test

• Interface Test

• Usability Test

• Compatibility Test,

• Performance Test

• Security Test

 Functional Test

1. Funcional Test
Figure 1: Functional Test

Link checks from pages to other pages: It should be ensured that the correct page is

navigated or redirected. In this way, it can be ensured that there are no dead pages or invalid

redirects.

Links on the same page: Links on the page should be checked one by one. E-mail links and

web forms, if any, should not be skipped.

Homework: Perform Unit Test with Selenium WebDriver.

2. Cucumber

Cucumber is a widely used tool for Behaviour Driven Development because it provides an
easily understandable testing script for system acceptance and automation testing.

BDD (Behavioral Driven Development) is a software development approach that was


developed from Test Driven Development (TDD).

BDD includes test case development in the form of simple English statements inside a feature
file, which is human-generated. Test case statements are based on the system's behavior and
more user-focused.
BDD is written in simple English language statements rather than a typical programming
language, which improves the communication between technical and non-technical teams and
stakeholders.

In other words, "Cucumber is a software tool used by the testers to develop test cases for the
testing of behavior of the software."

Cucumber tool plays a vital role in the development of acceptance test cases for automation
testing. It is mainly used to write acceptance tests for web applications as per the behavior of
their functionalities.

In the Cucumber testing, the test cases are written in a simple English text,
which anybody can understand without any technical knowledge. This simple
English text is called the Gherkin language.
It allows business analysts, developers, testers, etc. to automate functional
verification and validation in an easily readable and understandable format (e.g.,
plain English).

We can use Cucumber along with Watir, Selenium, and Capybara, etc. It
supports many other languages like PHP, Net, Python, Perl, etc.

The use of the application consists of two parts, as can be seen in the picture
above. These; Features and Glue Code. It can also be easily converted to a
different programming language. In addition, the following headings are
included in the Cucumber Terminology.

 Feature : We define a behavior in the Feature part (eg: display the home
page for the application, make sure as a user that the page is loaded, I
want to see the home page, etc.

 Scenario: We create our scenario that is suitable for our request in the
feature section.

 Given-When-Then : Given defines the prerequisite state, the When


event, and Then finalizes the event in the when keyword.
 And
 But

Figure 3. Behavior Driven Development (BDD) with Cucumber – Example Scenario

2.1. BDD with Cucumber Test

Tests are the ability to easily convert Feature and Scenario statements of application use cases
written in almost plain text into runnable unit tests on platforms belonging to Java or other
languages. No coding knowledge is required for writing and reading application scenarios and
feature files. Thus, business analysts and domain experts can easily understand when they
read the features to determine the scope and limits of the tests.

So how does the Behavior driven development method work with Cucumber?
1. The expected behavior of the code to be tested is written in plain text.
2. Write several Step definitions that will perform the test.
3. The code to be tested is written.
4. The test is run.

In terms of test automation, Cucumber does not provide the opportunity to control the browser
from the screen, for such needs it is necessary to use tools such as selenium web driver.
Example:
Test scenarios start with Feature and continue with the name of the scenario to be tested on
the Scenario side. Then, the steps continue to be written using sub-headings and commands
such as Given, When, Then.

Here, as we mentioned above, we will talk about a test application written in ruby on a sign-
up scenario (Cucumber Feature and Scenario steps.). First, we direct the test to our application
running in our locale, then we give the links to be clicked during the test and the urls of the
pages to be directed accordingly.
Finally, the email and password validation processes required for the sign-in process are
performed, and the necessary information is entered in the form in our system, and the
scenario is tested.

 BDD Benefits

Normally, a project management process goes like this:

 Planning
 Design
 Development
 Test
 Delivery

As a problem in this method, it is a problem to communicate with the customer in the process
from the Planning phase to the Design phase. After all, you can't make the client read code.
That's why there should be a BA (Business Analyst) person in between.
With BDD there is a slight displacement in the process;
 Planning
 Design
 Test
 Development
 Delivery

The benefit of BDD with this relocation is that it becomes easier to create BDD scenarios
through stories created by BA (Business Analyst) and to establish relationships with
customers through these scenarios.

If we talk about the Agile method that we saw above, Agile includes the user in the process.
Agile, together with the user, adjusts all its organization and systems according to the
customer.
“If you are doing business with Agile methodology and not using BDD for application testing,
you are contradicting yourself. ”
Of course, the test can be not only following the behavior as described here, but also testing
the operation of all the units running in the background, both individually (unit-testing) and
together (integration-testing).

3. Katalon
Katalon Platform is an automation testing software tool developed by Katalon, Inc. The
software is built on top of the open-source automation frameworks Selenium, Appium with a
specialized IDE interface for web, API, mobile and desktop application testing. Its initial
release for internal use was in January 2015. Its first public release was in September 2016. In
2018, the software acquired 9% of market penetration for UI test automation, according to
The State of Testing 2018 Report by SmartBear.

Katalon is recognized as a March 2019 and March 2020 Gartner Peer Insights Customers’
Choice for Software Test Automation.

You can test your Web, Mobile and Desktop (latest version 7.0)
applications, as well as use them in your test automation processes of your
backend services. Thus, you can manage your testing processes in a hybrid
way on a single platform. You can easily integrate the scripts you have
prepared into your CI/CD processes, so you can automate your software
quality processes.

 Katalon Features

 It is a Java-based application.

 Scripts prepared without writing an additional script can be run


separately or simultaneously in many browsers such as
Chrome, Firefox, Safari, Edge.

 Thanks to the Record&Play feature, the processes can be


prepared easily without having knowledge about script writing.
 With Slack integration, real-time feedback and communication
between team members can be provided.

 You can enable git integration for source control.

 You can start the application by running the run file without
any installation, you can start using it quickly with the
keywords in it. (https://katalon.com/download)

 Many of its features are free, and in new versions, paid features
have been started to be used.

 Katalon Studio consists of many utilities such as built-in


keywords, custom keywords, objects spying and recording, and
code refactoring that simplifies your code process.

 It works with the Page Object Model (POM) design model, which
aims to improve test maintenance and eliminate code duplication.
 It uses the selenium library in the background for web automation
and the appium library for mobile automation.

 For test data, it provides a data file object that can query data from
external sources such as CSV file, excel file, relational database.

 Katalon Studio offers BDD testing capability with files with


the .feature extension.

 Katalon Studio uses Grid — TestOps Cloud to run tests entirely in the
cloud and automatically deliver results to Katalon Analytics. Katalon
Analytics is an artificial intelligence supported platform that provides
users with detailed dashboards and reports about test executions.
KAYNAKLAR
2. https://www.mobilhanem.com/web-uygulama-testleri-nelerdir/
3. https://teknoloji.org/selenium-kutuphanesi-nedir-nasil-kullanilir/
4. https://medium.com/@ilkebasalak/selenium-nedir-8c7d908c93e6
5. https://cucumber.io/
6. https://www.javatpoint.com/cucumber-testing
7. http://www.defnesarlioglu.com/cucumber-ile-behaviour-driven-development/
8. https://www.linkedin.com/pulse/cucumber-ile-behaviour-driven-development-bdd-
halil-bozan/?originalSubdomain=tr

You might also like