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

unit 5 pdf

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

unit 5 pdf

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

UNIT-5

List of Content
1. Testing Tools and automation:
Various types of testing
Automation of testing Pros and cons
2. Selenium –
Introduction,
Selenium features
3. JavaScript testing
4. Testing backend integration points
5. Test-driven development
6. REPL-driven development
7. Deployment of the system:
Deployment systems
8. Virtualization stacks
9. code execution at the client
10. Puppet master and agents
11. Ansible
12. Deployment tools:
Chef, Salt Stack and Docker
Introduction to Testing
What is testing?

> Software Testing is a method to check whether


the actual software product matches expected
requirements and to ensure that software
product is Defect free.

> It involves execution of software/system


components using manual or automated tools to
evaluate one or more properties of interest.

> The purpose of software testing is to identify


errors, gaps or missing requirements in contrast
to actual requirements.
Manual testing:

> Manual testing is a software testing


process in which test cases are executed
manually without using any automated tool.

> All test cases executed by the tester


manually according to the end user's
perspective. Test case reports are also
generated manually.

> Manual Testing is one of the most


fundamental testing processes as it can find
both visible and hidden defects of the
software.
> Manual Testing requires knowledge of manual
testing techniques.

> Manual testing is mandatory for every newly


developed software before automated testing.
This testing requires great efforts and time, but
it gives the surety of bug-free software.

Acceptance Testing:
> It is type of testing where the final product is
tested to ensure it meets the requirements and
works as expected for the end users.

> Acceptance Testing is hard to automate and it


is hard to understand for developers , so it is
done by quality assurance (QA) team.
Types of Manual Testing:
1. White-box testing : The white box testing is done
by Developer, where they check every line of a code
before giving it to the Test Engineer.

2. Black box testing: The black box testing is done


by the Test Engineer, where they can check the
functionality of an application or the software
according to the customer /client's needs.

3. Gray Box testing: Gray box testing is a


combination of white box and Black box testing. It
can be performed by a person who knew both
coding and testing. And if the single person
performs white box, as well as black-box testing for
the application, is known as Gray box testing.
How to perform Manual Testing?
> First, tester observes all documents related to software,
to select testing areas.

> Tester analyses requirement documents to cover all


requirements stated by the customer.

> Tester develops the test cases according to the


requirement document.

> All test cases are executed manually by using Black box
testing and white box testing.

> If bugs occurred then the testing team informs the


development team.

> The Development team fixes bugs and handed software


to the testing team for a re-test.
What is Automation Testing?

> Automation Testing is a software testing technique


that performs using special automated testing
software tools to execute a test case suite.

> The automation testing software can also enter test


data into the System under Test, compare expected
and actual results and generate detailed test reports.

> Software Test Automation demands considerable


investments of money and resources.

> Successive development cycles will require


execution of same test suite repeatedly. Using a test
automation tool, it’s possible to record this test suite
and re-play it as required.
> Once the test suite is automated, no human
intervention is required. This improved ROI of Test
Automation. The goal of Automation is to reduce the
number of test cases to be run manually and not to
eliminate Manual Testing altogether.

Why Test Automation?


> Test Automation is the best way to increase the
effectiveness, test coverage, and execution speed in
software testing.

> Automated software testing is important due to the


following reasons:

1. Manual Testing of all workflows, all fields, all negative


scenarios is time and money consuming It is difficult to
test for multilingual sites manually
2. Test Automation in software testing does not
require Human intervention.

3. You can run automated test unattended


(overnight)

4. Test Automation increases the speed of test


execution Automation helps increase Test
Coverage.

5. Manual Testing can become boring and hence


error-prone.
Figure: Automated Testing Process
Which Test Cases to Automate?

> Test cases to be automated can be selected


using the following criterion to increase the
automation ROI

1. High Risk – Business Critical test cases

2. Test cases that are repeatedly executed

3. Test Cases that are very tedious or


difficult to perform manually

4. Test Cases which are time-consuming


Pros and cons with test automation
Pros or benefits of Automation Testing:
1. 70% faster than the manual testing
2. Wider test coverage of application features
3. Reliable in results
4. Ensure Consistency
5. Saves Time and Cost
6. Improves accuracy
7. Human Intervention is not required while
execution
8. Increases Efficiency
9. Better speed in executing tests
10. Re-usable test scripts
11. Test Frequently and thoroughly
12. More cycle of execution can be achieved
through automation
13. Early time to market
The problem areas surrounding test automation:

>When people talk about automation test, they


get excited because it has many benefits like:
1. Better software quality.
2. More confidence that software releases will
work as expected.
3. Less boring when compare to manual testing.

> Testing software is essential to make sure it


works well.

>Manual Testing is tool slow for continuous


Delivery , so automation test is needed. But
there are problems.
1. Cheap Tests have Lower Value:
Unit Tests are easy and cheap to write , but
people think manual testing finds more bugs.
So they might skip unit tests.

2. Difficult Test Environment:


Its easy to test small parts of the code, but
hard to create realistic test setups for the
whole system. This can due to hardware ,
licenses or people.

3. Constant changes in software:


Immediately whenever we changes code , we
need to perform testing which takes time. This
makes automation test extra work.
4. Hard to write Good test code:
Writing good automated test code can be
difficult. However, when you succeed, you
gain a deeper understanding of how
automated testing works. This knowledge
helps you improve the project and catch
issues early.
What is Selenium?

Selenium is a free (open-source) automated


testing framework used to validate web
applications across different browsers and
platforms.

> You can use multiple programming languages


like Java, C#, Python, etc to create Selenium Test
Scripts.

> Testing done using the Selenium testing tool is


usually referred to as Selenium Testing.

> Selenium is one of the most widely used Open


source website testing tool developed Jason
Huggings in 2004.
Why Selenium?

1. Automated Testing:
Selenium allow you to write scripts that
perform tasks on a website, such as clicking
buttons, filling out forms or checking. If
certain text is visible. This saves time
because you don’t have to do these tasks
manually.

2. Cross Browser Testing:


Selenium can work will different web browser
like chrome, FireFox, safari. This means you
can test your website on popular browsers to
ensure it will work well.
3. Supports multiple Language:
You can write selenium test code in several
programming language like python, java, C#,
JavaScript.

4.Open Source:
Many companies and developers use selenium
because it is free to download and use.

5. Supports multiple operating systems


Selenium Tool Suite
Selenium Software is not just a single tool but
a suite of software, each piece catering to
different Selenium QA testing needs of an
organization. Here is the list of tools
1. Selenium Integrated Development
Environment (IDE)
2. Selenium Remote Control (RC)
3. WebDriver
4. Selenium Grid
Selenium Features:
> Selenium is an open source and portable
Web testing Framework.

> It also supports parallel test execution which


reduces time and increases the efficiency of
tests.

> Selenium can be integrated with frameworks


like Ant and Maven for source code
compilation.

> Selenium can also be integrated with testing


frameworks like TestNG for application testing
and generating reports.

> Selenium requires fewer resources as


compared to other automation test tools.
> WebDriver API has been indulged in selenium
which is one of the most important modifications
done to selenium.

> Selenium web driver does not require server


installation, test scripts interact directly with
the browser.

> Selenium commands are categorized in terms


of different classes which make it easier to
understand and implement.

> Selenium Remote Control (RC) in conjunction


with WebDriver API is known as Selenium 2.0.

> This version was built to support the vibrant


web pages and Ajax.
Figure: Selenium Tool Suite

At the moment, Selenium RC and WebDriver are


merged into a single framework to form Selenium
2.
Selenium 1, by the way, refers to Selenium RC.
How Selenium Works?

> Selenium uses a special driver for each browser


when you write a test script, selenium sends
commands to the browser through these driver.

> It supports parallel testing , which reduces time.

> In DevOps, we can integrate selenium with


automation tools like Jenkins and Docker to achieve
continuous testing.

> Selenium is an essential tool to check whether


website is working correctly or not.

> It automates repetitive tasks and save time so the


developers can test their websites on different
browsers.
JavaScript testing

> Today many software applications or


services that people use have web interfaces,
which means they are used through web
browsers like chrome or Firefox.

Example: Amazon , Flipkart

> We can run web interfaces using JavaScript.


Its important to have good tools to test the
JavaScript code that runs these interfaces.
Here are some important JavaScript testing
tools.

1. Karma: This is a tool that runs unit tests for


JavaScript. Unit test check small part of your
code to make sure they work correctly.
2. Jasmine: This tool tests how software behaves
in different situations.

3. Protractor: It is a popular tool for creating and


testing web applications. Specially designed for
testing application build with Angular JS.

> Although you can use a general tools like


selenium to test web applications, Protractor is
better for Angular JS applications.

> It understand how Angular JS works and


making it easier to test these type of
applications.

> These tools help developers make sure their


web applications work well and behave correctly,
which is very important in today’s software
development.
Testing Backend Integration Points

> Backend Testing is like checking the parts of a


machine that you can’t see when you use a website or
an app.

> The front end is what you interact with like buttons ,
images, text.

> The backend is everything behind the scenes that


makes the front end work (like databases, servers,
applications)

> Backend testing ensures that all these hidden parts


are working correctly, storing data properly and
communicating with each other without any errors.

> It involves checking the Databases, Servers and APIs


to make sure everything functions correctly.
> SOAP (Simple Object Access Protocol) and
REST(REpresentation State Transfer) are two
different methods used to automate backend
testing, especially for websites and APIs.

> SOAP UI is a tool that helps you to write and


run backend testing. Using SOAP UI you can
test step by step and it is easy to use.

Benefits of SOAP UI:


1. Easy for testers: It is easy to write and run
tests.

2. Good for developers: Developers can add


testing without using SOAP UI’s main screen,
directly they can use command line or directly
they can integrate testing in CICD process.
3. Free Version: SOAP UI ids free to download
and use.

How SOAP UI works?

> SOAP UI interface displays a list of tests


(called test cases) on one side of the screen.

> This makes it easy to select the tests you


want to run.

> You can choose to run a single test or


multiple test simultaneously.

> The result of the test are displayed on the


other side of the interface
> SOAP UI saves scripts in XML format.

> This XML format makes easy to organize,


read and modify the test. Similar to how code
is organized in programming.

> Since the test are stored as XML you can


easily update or change the test cases as
needed.
Test Driven Development

> Test Driven Development (TDD) is a way of


developing software where you write tests
before you write the actual code.

> It became popular in the 1990’s because of


Extreme Programming.

How Test Driven Development (TDD) works?


1. Write the test first- At first you need to
understand all requirements and features of new
software that you want to create.

2. Check the test fails- Initially we don’t write


code to develop the software/application, so
when we perform testing, the test should fail.
This is expected because there is no code to pass
your test.
3. Write the code- Next, start writing code by
selecting basic features of your software. In
this stage it doesn’t have to be perfect, it just
needs to work and pass the test.

4. Run all tests- After writing complete code,


run all existing tests. If we pass all existing
tests, then testing is successful.

5. Improve the code- This step is also called as


“Refactoring”. The word "refactor" has
mathematical roots. In programming, it means
cleaning up the code and, among other things,
making it easier to understand and maintain.
> TDD helps you understand what the
software should do before you start coding.

> It also creates tests that make sure


everything works correctly, even when you
make changes later. This is useful for CICD
process.
REPL-driven development:

> REPL stands for Read Eval Print Loop.

> It is a software, where you can write and test


your code, using languages like Lisp, Python,
Ruby and JavaScript.

> In this software, you can write code,


immediately run and test it and see the result.
This allows for quick testing and feedback as you
develop.

How REPL works?


1. Write small Functions- You create small,
focused functions that do one specific task.
These functions should be independent, meaning
they don’t depend heavily on other parts of the
code.
2. Immediate Testing- As soon as you write a
function, you can run it in REPL. This will
check if it works correctly. If there is a
problem you can fix it.

Different from Test Driven Development:


In Test Driven Development (TDD), you write
tests before writing the actual code. Whereas
in REPL, you can write a test code
simultaneously, This can be easy for some
developers.

Combining with unit testing:


While using REPL, you can also create unit
tests for functions. Unit Test check if
individual piece of code work correctly or not.
Benefits of REPL:

1. Quick Feedback- You get instant feedback on your


code, which helps you identify and fix problems faster.

2. Simplicity- Writing small functions makes your code


more straight forward and manageable.

3. Enhanced Learning- For beginners, using a REPL can be


a great way to learn programming concept, as you can
experiment without a complex setup.

> REPL Driven Development is an effective approach,


especially for those new to programming.

> It allows writing clear, independent functions and


allows for immediate testing making it a useful strategy
in the software development process.
Deployment of the system

> A Deployment System in DevOps is a tool or


set of tools that automatically move new
software from the developer’s computer to
the production server, all users can access it.

Why are there so many development


systems?
> There are so many deployment system
because deploying software can be complex.

>Imagine we have an application, with three


main parts,
1. Web Server- manages website requests.
2. Application Server- Runs the main program.
3. Database Server- stores data.
Developer Deployment Software Production
Develope System Software Server
r
created s m ent
oftware e p lo y
in local m
achine Using D w a re, the th e s oftware
S o ft On ce
System keep on
develo p e r c a n is deployed ver,
re on ser
the s oft w a production
u c ti o n Server the users c
an
prod
access it

Figure: Deployment System Architecture


> If we only had one server handling all these
parts and if we want to update this software
once a year, we could install this software
manually. But,
 Manual work is boring
 Manual work can lead to mistakes.

> In real life, Big companies have many


servers and applications and each server and
application might need different methods for
updating.

> We can run our application on,


1. A Physical Server
2. A Virtual Machine
3. A Container (a light weight way to run
apps)
> If you want to run an application on
physical server, we need one type of
deployment system, similarly with virtual
servers also.

Main Duties of a Deployment System:

1. Automatically place the application on the


server.

2. Apply updates or new versions of the


application.

3. Set up the necessary configurations to run


the application properly.
Virtualization stacks
> Virtualization is technology that you can
use to create virtual representations of
servers, storage, networks, and other
physical machines.
Servers Desktop

Application Storage

Network
Data
> Virtualization makes you create virtual
computers (called virtual machines) inside
your real computer.

> These virtual machines acts like real


computer with their own virtual hardware
(like CPUs and network cards).

> You can use Virtualization to test different


types of hardware on your computer.

> For example, you can test an android phone


on your computer using tool like QEMU to test
mobile apps.
Use of Virtualization:

> Imagine you have a big computer that run


many programs, virtualization will create
separate “Mini computer” inside your big
computer.

> If one “mini computer” has problem or uses


too much power, it wont affect the other “mini
computer”.

> For Example, your big computer is powerful


with 64 cores (like having 64 small CPUs). You
can create virtual machine that uses only 2
cores out of 64 cores. If this virtual machine
has issues, only those 2 cores are affected,
not the entire big computer.
Hypervisors: The Key to Virtualization

> A Hypervisor is a special program that


creates and manages virtual machines (VM).
It shares the computer resources like CPU and
memory among these VMs.

> Or A hypervisor is a software that you can


use to run multiple virtual machines on a
single physical machine.

> Every virtual machine has its own operating


system and applications.
Hardware OS Hypervisor

Virtualized OS
There are two main types of Hypervisors:

1. Bare Metal Hypervisor- It runs directly on the


computer hardware. It doesn’t need an OS to run.
Eg. VMware ESX

2. Hosted Hypervisor- Its runs on top of an OS


and its needs an OS to function.
Eg. KVM on Linux

Popular Virtualization Tools:

1. VMware- A well-known tool that comes in


desktop and server versions. VMware ESX is used
directly on hardware.
2. KVM- (Kernel-based Virtual Machine) A free
tool for Linux popular because it doesn’t have
extra costs.

3. Xen- A tool that can run modified OS for


better performance.

4. Virtual Box- A free tool from Oracle, good


for developers to run different OS on their
computers.

Automating with APIs: Virtualization tools


come with APIs that helps manage VMs
automating. One popular API is libvirt, which
works with various hypervisors like KVM, Xen,
LXC.
ParaVirtualization

> Paravirtualization is a type of virtualization


where software instructions from the guest
operating system running inside a virtual
machine can use “hypercalls” that
communicate directly with the hypervisor.

> The main benefits of paravirtualization are


where instructions are not compatible with
full virtualization

> For timing-critical functions,


paravirtualization can provide the speed of
native code alongside some of the benefits of
virtualization, such as sharing hardware
between multiple operating systems.
The hypervisor provides a calling
mechanism for guests. Such calls
are referred to as hypercalls. Each
hypercall defines a set of input
and/or output parameters.
Examples of Paravirtualization

Paravirtualization has been available from


several vendors for some years. Virtual
machine platforms supporting
paravirtualization include:

1. VMware ESXi hypervisor

2. Xen open-source hypervisor

3. Oracle VM VirtualBox hypervisor

4. QNX Hypervisor
Executing Code on the Client
> By using some tools you can run commands on servers and
manage them.

> For example, if you want to check files on all your web servers,
you can use these tools to do it.

1. Puppet- It is a tool used in IT to manage and automate setups on


servers.

2. Mcollective- It is tool that works with puppet to manage and


execute commands on multiple servers at once.

3. Ansible

4. PalletOps
5. Chef
6. SaltStack
7. Vagrant
8. Docker
9. Kubernetes

> By running commands we can collect


information for all servers.

> These tools make it easy to run commands on


many servers at the same time, which can be
useful for performing various operations.
The Puppet master and Puppet Agents

> Puppet is a popular tool used in large


organizations to handle setup and updates on
servers.

> In puppet software, there are two main


components.

1. Puppet Master- It is a central Server that


send server updates to the puppet agent.

2. Puppet Agents-
> They are individual server, which check in
regularly with puppet master to see if
anything need to be updated in their servers.
> Since servers run many applications, it is
essential to keep servers up-to-date. This can
be achieved by Puppet.
Main Server

Puppet
Master
SSL SSL
SSL
Server 1 Server 2 Server N

Puppet Puppet Puppet


Agent 1 Agent 2 Agent N

Figure: Puppet Architecture


> Puppet Master and Puppet Agent
communicate through SSL (Secure Socket Layer).

> Puppet provides a lot of flexibility in handling


the complexity of a server farm, and as such, the
tool itself is pretty complex.

> This is an example scenario of a dialogue


between a Puppet client and a Puppet master:

1. The Puppet client decides that it's time to


check in with the Puppet master to discover any
new configuration changes. This can be due to a
timer or manual intervention by an operator at
the client. The dialogue between the Puppet
client and master is normally encrypted using
SSL.
2. The Puppet client presents its credentials so
that the Puppet master can know exactly which
client is calling. Managing the client credentials
is a separate issue.

3. The Puppet master figures out which


configuration the client should have by
compiling the Puppet catalogue and sending it
to the client. This involves a number of
mechanisms. It is pretty common to have both a
role-based and concrete configuration for a
Puppet client.
4. The Puppet master runs the necessary code on the
client side such that the configuration matches the
one decided on by the Puppet master.

There are both pros and cons of the Puppet


ecosystem:

> Puppet has a large community, and there are a lot


of resources on the Internet for Puppet. There are a
lot of different modules.

> Puppet requires a number of dependencies on the


Puppet client machines. Sometimes, this gives rise to
problems.

> Puppet configurations can be complex to write and


test.
Ansible

> Ansible is a tool that helps manage and


deploy software onto multiple servers in a
simple way.

> Unlike some other tools, Ansible doesn’t


need special software running on each server
to manage servers.

> Instead, Ansible connect to the servers


using SSH and runs commands to set them ,
you only need to install Ansible on the main
control machine.
Main Server

Ansible

SSH SSH
SSH
Server 1 Server 2 Server N

Node 1 Node 2 Node N

Figure: Ansible Architecture


Keypoints about Ansible:

1. No Extra Software Needed- When compare


to other tools, Ansible doesn’t need special
software on the servers to manage it.

2. Uses SSH- Ansible uses SSH to connect and


run commands on the servers.

3. Needs Python- The server being managed


by Ansible need to have python installed but
any version of python usually works fine.

>The speed of Ansible is less compared to


other tools.
How Ansible works?

> Ansible uses special files called “Playbooks”


to define what you want to do on the servers.

> These playbooks are written in YAML.

> For example, I want to check servers are


working or not. So I will create playbook to
perform this operation and use same
playbook in all servers.
PalletOps:

> PalletOps is an advanced deployment system,


which combines the declarative power of Lisp
with a very lightweight server configuration.

> PalletOps takes Ansible's agentless idea one


step further. Rather than needing a Ruby or
Python interpreter installed on the node that is
to be configured, you only need SSH and a Bash
installation.

> These are pretty simple requirements.


PalletOps compiles its Lisp-defined to Bash code
that is executed on the slave node.
Chef
> Chef is a Configuration Management tool used
to manage and deploy software an multiple
servers. It uses Ruby programming language
and helps automate the setup of servers.

How Chef works?


1. Recipes and Cookbooks- Chef uses files called
“recipes” to define what should be installed and
configured on your servers. A collection of
recipes is called a “Cookbook”.

2. Chef Server- All the cookbooks and


configuration data are stored on a central
server called the chef server. This is the main
place where everything is organized.
3. Node- These are individual servers you
want to manage.

4. Chef Client- This program runs on each


server (node) and checks which node need to
be configured.

> This process automate server setup,


ensuring all servers are consistently
configured without manual intervention.
Node
Chef Server
Work station Servers that
are managed
by chef. Each
node runs the
chef client for
updates.
s p la ce where
Th i n write
s tra ti o Central hub where
admini o k bo oks.
c o all cookbooks &
and test o rk station
e w configuration data
From th books are
ok are stored and it
these co o chef
dt distributes
uploade
information to the
server
nodes

Figure: Chef Architecture


Salt Stack
> Salt Stack, also known as Salt, is a
configuration management and orchestration tool.

> Salt Stack is a tool that helps manage and


control multiple servers.

> It uses a central repository to provision new


servers and other IT infrastructure, to make
changes to existing ones, and to install software
in IT environments, including physical and virtual
servers, as well as the cloud.

> It works by using a central server called “Salt


Master”, which sends instructions to the servers
to manage and configure called “Salt Minions”.
> These instructions are defined in files called
“State Files”.

> Salt Stack automates the process of setting


up , configuring, managing servers, making it
easier and faster to handle many servers at
once.

State Files Salt Minions


Salt
Master State Files
Salt Minions
State Files

Salt Minions

Figure: Salt Stack Architecture


Vagrant
> Vagrant is a tool for working with virtual
environments, and in most circumstances, this
means working with virtual machines.

> Vagrant provides a simple and easy to use


command-line client for managing these
environments, and an interpreter for the text-based
definitions of what each environment looks like,
called Vagrant files.

> Vagrant is open source, which means that anyone


can download it, modify it, and share it freely.

> Vagrant supports several virtualization providers,


and VirtualBox is a popular provider for developers.
Deploying with Docker:

> Docker is a software platform that allows


you to build, test, and deploy applications
quickly.

> Docker packages software into


standardized units called containers that have
everything the software needs to run
including libraries, system tools, code, and
runtime.

> Docker's model of creating reusable


containers that can be used on development
machines, testing environments, and
production environments is very appealing.
There are several emerging solutions, such as
these:

• Docker Swarm: Docker Swarm is compatible


with Docker Compose, which is appealing.
Docker Swarm is maintained by the Docker
community.

• Kubernetes: Kubernetes is modeled after


Google's Borg cluster software, which is
appealing since it's a well-tested model used
in-house in Google's vast data centers.
Kubernetes is not the same as Borg though,
which must be kept in mind. It's not clear
whether Kubernetes offers scaling the same
way Borg does.

You might also like