0% found this document useful (0 votes)
29 views79 pages

Stqa Lab Journal - Mc2146 Pise Sayali Kishor

The document outlines a practical laboratory course in Software Testing and Quality Assurance, detailing various testing methodologies such as Test Planning, Unit Testing, Data Flow Testing, and Mutation Analysis. It includes practical exercises aimed at preparing test plans, identifying test cases, and performing different types of testing on a social networking application for a college. The document serves as a comprehensive guide for students to understand and apply software testing techniques effectively.

Uploaded by

sayalikp9505
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views79 pages

Stqa Lab Journal - Mc2146 Pise Sayali Kishor

The document outlines a practical laboratory course in Software Testing and Quality Assurance, detailing various testing methodologies such as Test Planning, Unit Testing, Data Flow Testing, and Mutation Analysis. It includes practical exercises aimed at preparing test plans, identifying test cases, and performing different types of testing on a social networking application for a college. The document serves as a comprehensive guide for students to understand and apply software testing techniques effectively.

Uploaded by

sayalikp9505
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 79

P.G.DEPT.

OF COMPUTER SCIENCE

SOFTWARE TESTING AND QUALITY


ASSURANCE LAB
FYMCA | SEM 2

NAME: PISE SAYALI KISHOR

ROLL NO.: MC2146

FACULTY – DR. ANITA CHAWARE

ACADEMIC YEAR: 2021 – 2022


INDEX
Sr. Date Practical Page
No. no.
1 To Prepare Test Plan for the implemented system under test. The 3-6
Test Plan shall be based on System Requirement Specification.
The Test plan consists of following issues. a. Purpose of the
test. /Location and schedule of the test. b. Test descriptions.
/Pass and Fail Criteria.

2 To identify and narrate Test cases, Test scripts/procedures and Test 7-12
incident Report identifier for the system under test. Refer Use case
analysis document to prepare mentioned/ identified test documents.
The expected specifications/ behaviors can be stated with the help of
Test Oracle.

3 To perform Unit testing especially indicating the traced Independent 13-23


data paths, Control paths and Error handling paths. Prepare control flow
graphs for the unit under test. Compute the Cyclomatic complexity of
the unit.
4 To perform Data Flow testing for the Program Segments by identifying 24-32
the Definition-Use chain and type of data flow anomaly.

5 To perform Mutation Analysis of the Program Segments along with 33-43


mutant history, mutation score and type of mutation by using any Code
analysis Tool / Mutation Testing Tool (JUNIT).

6 To perform black box testing for all the units contained in the 44-51
architectural segments using Equivalence partitioning, Boundary value
analysis and Orthogonal Array testing methods. To study exploratory
testing for the module under test and merits/demerits of the technique

7 To perform Regression Testing / GUI Testing of the System under 52-60


construction with Unit and Integration profiles by using any Functional
Testing Tool.
8 To perform Automated Testing using suitable CASE
tools addressing Higher Order testing strategies.
60-
67
To perform Web Based Testing for Web Application
incorporating any open source tool. To study
9 performance testing, load testing, security testing, 67-72
stress testing, Demonstrate on link Test expectation

-10
Installing Docker on Linux, Docker- Installation, Basic 72-
Docker Commands, working with Containers. 77

11 Building a Web Server Docker File 77-


79

PRACTICAL NO. 01
1 To Prepare Test Plan for the implemented system under test. The Test
Plan shall be based on System Requirement Specification. The Test
plan consists of following issues. a. Purpose of the test. /Location and
schedule of the test. b. Test descriptions. /Pass and Fail Criteria.

Introduction
 A Social Network for college with different modules which helps the
students get a closer look at the university without being a part of it.
The college websites give an overview of all the major subjects being
taught in the college and the other sub subjects in the major fields. The
website gives an overview of the campus and various departments
being carried out in the college. The brief description of the faculty is
also described on the website.

1.1 Objectives

User friendly interface.

A central database holds the key to system.

All forms are html templates driven

Integration among all functional areas.

The availability of the information is easy

Routine tasks are easily performed

It automates the redundant tasks

It is cost effective

Code Generation: -

The design must be translated into a machine-readable form. The code


generation step performs this task. If design is performed in a detailed
manner, code generation can be accomplished mechanistically.
Testing: -

Once code has been generated, program testing begins. The testing process
focuses on the logical internals of the software, ensuring that all statements
have been tested and on the functional externals, that is, conducting tests to
uncover errors and ensure that defined input will product actual results that
agree with required results.

• External Interfaces of the system: They identify the information which is


to flow , from and to the system.

• Functional and non-functional requirements of the system. They stand


for the finding of run time requirements.

SR No. Module Sub Test Scenarios Objective


Name Module
Name
1 Calculator Add To verify the addition of two numbers.
Program

Sub To verify the subtraction of two numbers.

Mul To verify the Multiplication of two numbers.

Div To verify the division of two numbers.

Exit To verify the termination of program.

2 Transaction To verify the functionality of records saved in


Management database successfully.
Program using
JDBC
3 Java Test Java Test To verify the functionality of all the answers
Program using are correct in test.
Servlet

To verify the functionality that if any or all


answers are wrong in test.

4 Login Page Login To verify the functionality of username and


Program password.

5 Program on Submit To verify the functionality of updated record


Updating the in table.
table

Reset To verify the functionality of reset text-field


on page.
PRACTICAL NO. 02

2: To identify and narrate Test cases, Test scripts/procedures and Test


incident Report identifier for the system under test. Refer Use case analysis
document to prepare mentioned/ identified test documents. The expected
specifications/ behaviors can be stated with the help of Test Oracle.

INTRODUCTION

Test Case: A test case is a specification of the inputs, execution conditions,


testing procedure, and expected results that define a single test to be
executed to achieve a particular software testing objective.

Test Plan: “Test Plan is A document describing the scope, approach, resources,
and schedule of intended test activities.”

Test Script: Test Scripts are a line-by-line description of all the actions that are
necessary to perform and test on specific user journeys. It lists out each step
that should be taken with the expected results

What is the Importance of a Test Plan?

Making Test Plan document has multiple benefits

Help people outside the test team such as developers, business managers,
customers understand the details of testing.

Test Plan guides our thinking. It is like a rule book, which needs to be followed.

Important aspects like test estimation, test scope, Test Strategy are
documented in Test Plan, so it can be reviewed by Management Team and re-
used for other projects.

How to write a Test Plan?

You already know that making a Test Plan is the most important task of the
Test Management Process.

Follow the seven steps below to create a test plan as per IEEE 829

1. Analyze the product


2. Design the Test Strategy

3. Define the Test Objectives

4. Define Test Criteria

5. Resource Planning

6. Plan Test Environment

7. Schedule & Estimation

Determine Test Deliverables

Analyze the product:

How can you test a product without any information about it? The answer is
Impossible.
You must learn a product thoroughly before testing it.

Develop Test Strategy:

Test Strategy is a critical step in making a Test Plan in Software Testing. A Test
Strategy document is a high-level document, which is usually developed by
the Test Manager. This document defines: The project’s testing objectives and
the means to achieve them
Determines testing effort and costs You should follow steps below to develop
test strategy.

Define Scope of Testing: Before the start of any test activity, scope of the
testing should be known. You must think hard about it. The components of
the system to be tested (hardware, software, middleware, etc.) are defined as
“in scope“.

The components of the system that will not be tested also need to be clearly
defined as being “out of scope.” Defining the scope of your testing project is
very important for all stakeholders. How do you determine the scope of your
project?

To determine scope, you must –

Precise customer requirement


Project Budget

Product Specification

Skills & talent of your test team Problem Scenario The customer wants you to
test his API.
But the project budget does not permit it. In such a case what will you do?

Identify Testing Type : A Testing Type is a standard test procedure that gives
an expected test outcome.

Document Risk & Issues Risk is future’s uncertain event with a probability of
occurrence and a potential for loss. When the risk actually happens, it
becomes the ‘issue’.

Create Test Logistics In Test Logistics, the Test Manager should answer the
following questions: Who will test? When will the test occur?

Define Test Objective Test Objective

It is the overall goal and achievement of the test execution. The objective of
the testing is finding as many software defects as possible; ensure that the
software under test is bug free before release.

To define the test objectives, you should do 2 following steps

List all the software features (functionality, performance, GUI…) which may
need to test.
Define the target or the goal of the test based on above features

Based on above features, you can define the Test Objective of the project
Online Notice board System as follows. Define Test Criteria

Test Criteria is a standard or rule on which a test procedure or test judgment

can be based. Resource Planning:

Resource plan is a detailed summary of all types of resources required to


complete project tasks. Resource could be human, equipment and materials
needed to complete a project.

Plan Test Environment


A testing environment is a setup of software and hardware on which the
testing team is going to execute test cases. The test environment consists of a
real business and user environment, as well as physical environments, such as
server, front end running environment.

Test Deliverables

Test Deliverables is a list of all the documents, tools and other components
that have to be developed and maintained in support of the testing effort.

There are different test deliverables at every phase of the software


development lifecycle

Test deliverables are provided before testing phase.

Test plans document.

Test cases documents

Test Design specifications.

Test deliverables are provided during the testing

Test

Scripts

Simulator

s.

Test Data

Test Traceability Matrix Error logs and execution logs.

Test deliverables are provided after the testing cycle is over.

Test Results/reports

Defect Report

Installation/ Test procedures guidelines

Release notes
Abstract:

A Social Network for college with different modules which helps the students
get a closer look at the university without being a part of it. The college
websites give an overview of all the major subjects being taught in the college
and the other sub subjects in the major fields. The website gives an overview
of the campus and various departments being carried out in the college. The
brief description of the faculty is also described on the website.

FRONT END-

PHP

 PHP is a server side scripting language to create dynamic web page. PHP
Stands for Personal Home Page or Hypertext Preprocessor.

 PHP code is executed on the server, and the plain HTML result is sent to
the browser. A PHP scripting block can be placed anywhere in the
document. It always starts with <?php and ends with ?>.

MySQL (Back-end)

 The MySQL Database powers the most demanding Web, E-commerce


and Online Transaction Processing (OLTP) applications.

CSS (Cascading Stylesheet)

It is a way of formatting the web page layout such as image, text, font
everything we put on the web page.

Software Requirement

 Windows 7 or above

 Dreamweaver cs-2

 Wamp Server

 HTML / CSS / JAVA SCRIPT

OUTPUT
PRACTICAL NO. 03
To perform Unit testing especially indicating the traced Independent data
paths, Control paths and Error handling paths. Prepare control flow graphs
for the unit under test.
Compute the Cyclomatic complexity of the unit.

Introduction to Path Testing

Path Testing is a white-box testing technique based on the control structure of


a program or a module. Using this structure, a control flow graph is prepared
and the various possible paths present in the graph are executed as a part of
testing

Path testing is a technique of selecting the paths in the control flow graph that
provide a basis set of execution paths through the program or module.

Path Testing Techniques:

1) Control Flow Graph (CFG)


Represent Program or Algorithm Unit Used CFG To Find Independent
Path For Execution Using Cyclomatic Complexity.
2) Cyclomatic Complexity
It Just Numbers That Measure the Decision Logic In The Program Unit. It
Is The Minimum No Of Tests Required For The Program Unit.
Path testing steps in software testing:
1. Draw the control flow graph
2. Calculate cyclomatic complexity using all the
methods
3. Generate a set of independent path paths.
4. Design test cases from independent paths.
Aim: Linear Search

class LinearSearch{

public static int search(int arr[], int x)

1. int n = arr.length;

2. for (int i = 0; i < n; i++)

if (arr[i] == x)

3. return i;

4.. return -1;

// Driver code

public static void main(String args[])

5. int arr[] = { 2, 3, 4, 10, 40 };

6. int x = 10;

// Function call

7. int result = search(arr, x);

8. if (result == -1)
9. System.out.print(

"Element is not present in array");

10. else

11. System.out.print("Element is present at index "

+ result);

}
PRACTICAL NO. 04
To perform Data Flow testing for the Program Segments by identifying the
Definition-Use chain and type of data flow anomaly.
Introduction

Data Flow Testing is a type of white box testing technique. Data-flow testing
(DFT) is a family of testing strategies designed to verify the interactions
between each program variable's definition and its uses. Data Flow Testing is a
specific strategy of software testing that focuses on data variables and their
values. It makes use of the control flow graph. It is done to cover the path
testing and branch testing gap. The process is conducted to detect the bugs
because of the incorrect usage of data variables or data values.

Data-flow

testing

Important

terms:

(d)Defined, created, initialized the

variable eg:- int a=5;

It include data declaration

Node can be the define node:-variable is assign the value.

(u)Use of

variable

eg.:

x=a+1;

Node can be use node: variable value used in operation or in computation.

P-use (predicate (condition) use): (eg. n!=0)

C-use (computation use): (eg for variable n: sum= sum+n).

O- use 🡪output use (print statement)

I-use 🡪iteration use(i=i+1)

L-use 🡪location use (access the array variable)


(k)killing ,undefined, released :-heap,stack,delete.

Consideration of data flow anomalies leads to test path selection strategies


that fill the gaps between complete statement testing.

There are nine possible two letter combinations for’d’, 'k' and 'u'. Some are
bugs, some are suspicious and some are okay.

~u first use Bug : data is used without definition

~k first kill Bug: data is killed without defining it

~d define last Bug: defining but not using it dd

define-define Bug: redefining the data. Probably

harmless, but suspicious. dk: define-kill Bug:

data is killed without using.

kk: kill-kill Bug: destroying already killed

data. Harmless but probably buggy ku:

kill-use Bug: data is used after destroying

it.

kd: kill-define Normal situation. An object is killed and

then redefined.

du: define-use The normal case. The object is defined

and then used.

ud: use-define Usually not a bug because the language permits

reassignment at almost any time.

uk: use-kill

Normal situation

uu: use-use

Normal situation
Types of Data Flow Testing

Static Data Flow Testing

There is not actual execution of the code is carried out in Static Data flow
testing Generally, the definition, usage and kill pattern of the data variables is
done through a control flow graph.eg: syntax error are caught by static
analysis.

Static testing deficiencies

Dead variable:-detecting unreachable variable is unsolved in the general case.

Arrays: dynamically allocated arrays contain garbage unless they are initialized

explicitly. pointers:-impossible to verify pointer values at compile time.

Dynamic Data Flow Testing

The code is executed and based on intermediate value that result from the
program execution. eg. a division by 0 error caught by dynamic analysis

Dynamic data flow testing includes:

Identification of definition and usage of data variables.

Identifying viable paths between definition and usage pairs of data variables.

Designing & crafting test cases for these paths.

Some dataflow anomaly can be detected by static Analysis and some


anomalies after find after compilation. compiler are able to detect several
data flow anomalies using static analysis. eg:-by forcing use before
declaration, a compiler can detect anomalies. such as:- -u , ku.

There are 2 way to write the definition and usage node.

1)In table form:-

2) Using syntax

For every statement we define 2 set

DEF(S) = {X | statement S contains the definition of X}


Example 1. a=b; DEF (1)={a} and USES (1) ={b}

USE(S) = {X | statement S contains the use of X}

Example 1. a=a+b; DEF(1)={a} ,USE(1)={a,b}

Example 1:-

1. x(){

2. int a=5; //define variable a

3. while(c>5){

4. if (d<50)

5. b=a*a; // use variable a

6. a=a-1; // define variable a and also use of variable a

7. }

8 print(a);} //use variable a

DEF(2)={a} Use(5)={a} DEF(6)={a } Use(6)={a} USE(8)={a}

A variable x is said to be live at

statement s1 if. x is defined at a

statement s:

There exists a path from s to s1 not containing any definition of x

Define-Use Chain/ Testing. (DU Path)

DEF-USE association is also called to DEF-USE chain

Du chain is triplet consisting.

[X, S, S1]

S and S1 are the

statement number x
is DEF(S) x is USES

(S1)

Where, x= name of variable

s=statement in which definition of

variable contains.

s1=statement in which it is live means the statement use of variable x

Also it that there is sub path in the flow graph from s to s1 with no other
definition of x between s and s1.

1. x(){

2. int a=5; //define a variable

3. while(c>5){

4. if (d<50)

5. b=a*a; // use variable a

6. a=a-1; // define variable a and also use of variable a

7. }

8 print(a);} //use

variable a so on this

we can compute du

chain

[a,2,5]

[a,6,8]

Find Factorial of number:

import java.util.*;

public class factorial


{ public static void

main(String[] args) {

int fact =

1;

int i = 1;

Scanner sc = new Scanner(System.in);

System.out.println("Enter a number whose factorial is

to be found: "); int num = sc.nextInt(); while( i

<= num ) { fact = fact * i; i++;

System.out.println("\nFactorial of " + num + " is: " + fact);

}}

Control Flow Graph

Step1 Input- fact, I, num

Step2 I=1

Step3 Fact=1

Step4 Input(num)

Step5 While(i<=num)

Step6 Fact=fact*i

Step7 I=i+1

Step8 Input(n)
Step9 End While

Step10 Print(“factorial is:”+fact)

DEFINE USE TESTING PROCESS:-

1) Select the set of paths and test them to fine anomalies (bugs)

Eg: variable is used but not defined, variable is defined but not used,

variable used multiple times

2) All-paths means all paths in the control flow graph should be covered. , All
edges and all nodes.

3) DU Path (Define Use Path)

There are 6 data-flow testing metrics:

1.all defs coverage

2.all c-use coverage

3.all-p-uses coverage

4.all-c-uses/some-p-uses

5.all-p-uses/some-c-uses

6.all-uses coverage

1)All definition coverage:- Contain all the define variable path

(i,2,6)

(i,7,10)

(sum,3,10)

(sum,6,10)

(num,4,(5,f))

(num,8,5)
2)All c-use coverage :- Contain all computational use variable paths.

(i,2,6)

(i,2,7)

(i,2,10)

(i,7,10)

(sum,3,6)

(sum,3,10)

(sum,6,10)

3)All C-use some p-use coverage:- All c-use variables and if any

variable which is initialized but not used in and c-use then take

the p-use of that variable.

(i,2,6)

(i,2,7)

(i,2,10)

(i,7,10)

(sum,3,6)

(sum,3,10)

(sum,6,10)

(num,8,5)

4)All p-use coverage :- Contain all predicate use variable path.

(i,2,(4,f))

(i,2,(4,t))

(num,4,(5,t))

(num,4,(5,f))
5) all P-Use some c-use coverage:- All variables with p-use and if

any variable not used in p-use then take the c-use of that variable.

(i,2,(4,f))

(i,2,(4,t))

(num,4,(5,t))

(num,4,(5,f))

(i,7,10)

(fact,3,6)

44

(fact,6,10)

(num,8,5)

6)all uses coverage : It contains all P-use and C-use of the

variable. (i,2,(4,f))

(i,2,(4,t))

(i,2,6)

(i,2,7)

(i,2,10)

(i,7,10)

(fact,3,6)

(fact,3,10)

(fact,6,10)

(num,4,(5,t))

(num,4,(5,f))
(num,8,5) one simple
data flow testing
strategy :

• Every Du chain in a program be covered at least once


• Data flow testing strategies: useful for selecting test paths of a

program containing nested if and loop statements

PRACTICAL NO. 05
To perform Mutation Analysis of the Program Segments along with
mutant history, mutation score and type of mutation by using any
Code analysis Tool / Mutation Testing Tool (JUNIT).

1. What is Mutation Testing:-

• Mutation Testing is a type of software testing in which certain


statements of the source code are changed / mutated to check if
the test cases are able to find errors in source code.
• It is a type of White Box Testing which is mainly used for Unit
Testing.
• In mutation testing we insert errors purposely into a program
(under test) to verify whether the existing test case can detect the
error or not.
• In this testing, the mutant of the program is created by making
some modifications to the original program.
• The primary objective of mutation testing is to check whether
each mutant created an output, which means that it is different
from the output of the original program.
• Mutation Testing is also known as fault-based testing, program
mutation, error-based testing, or mutation analysis.
• The ideal case is that none of the test cases should pass.
• If the test passes, then it means that there is an error in the code.
We say that the mutant (the modified version of our code) lived.
• If the test fails, then there is no error in the code, and the mutant
was killed. Our goal is to kill all mutants.
• Mutation testing also helps to test the quality of the defined test
cases or the test suites with a bid to write more effective test
cases.
• The more mutants we can kill, the higher the quality of our tests.

Mutation Testing Concepts:


Mutants: Mutants is simply the mutated version of the source code, it means
a changed copy of original code. It is the code that contains minute changes.
When the test data is run through the mutant, it should ideally give us
different results from the original source code. Mutants are also called mutant
programs.

There are different types of mutants. These are as follows:


Survived Mutants:- As we have mentioned, these are the mutants
that are still alive after running test data through the original and
mutated variants of the source code. These must be killed. They are
also known as live mutants. Killed Mutants: - These are mutants
that are killed after mutation testing. We get these when we get
different results from the original and mutated versions of the
source code.
Equivalent Mutants: These are closely related to live mutants, in that,
they are ‘alive’ even after running test data through them. What
differentiates them from others is that they have the same meaning as
the original source code, even though they may have different syntax.

Types of Mutation Testing:

Mutation testing can be classified into three parts, which

are as follows: Decision mutations value mutations


Statement mutations

1. Decision mutations:-
 In this type of mutation testing, we will check the design errors.
 And here, we will do the modification in arithmetic and logical
operator to detect the errors in the program.
 The target here is the code that makes decisions, for example,
value comparisons.
 Like if we do the following changes in arithmetic operators:

o plus(+)→ minus(-) o
asterisk(*)→ double
asterisk(**) o
plus(+)→incremental
operator(i++)

 Like if we do the following changes in logical operators:

 Example:-
2. Value Mutations:-

 In this, the values will modify to identify the errors in the


program, and generally, we will change the following:
o Small value to higher value.
o Higher value to Small value
 Here, we introduce a mutation by changing the parameter
and/or constant values, usually by +/- 1.  Example:-

Original Code Modified Code


int arr = [2,3,4,5] let arr = [2,3,4,5]
for(int i=0; i<=10; i++) for(let i=1; i<=10; i++)
{ if(i%2==0){ int { if(i%2==0){ int
result=(i*2); result=(i*2);
} }
} }

3. Statement Mutations:-
 Statement mutations mean that we can do the modifications into
the statements by removing or replacing the line.
 Here, we delete or duplicate a statement in a code block. We
could also rearrange statements in a code block.
 In an if-else block, for example, we could delete the else part or
even the entire if-else block.  Example:-

STEPS FOR JUNIT TESTING IN NETBEANS:

Creating the Java Class Library Project


1. Choose File > New Project from the main menu.
2. Select Java Class Library from the Java category and click Next.
3. Type JUnit-Sample for the project and set the project location.
4. Deselect the Use Dedicated Folder option, if selected.

For this tutorial there is little reason to copy project libraries to a dedicated folder
because you will not need to share libraries with other users or projects.

Click Finish.

The first time that you create a JUnit test the IDE prompts you to select a version
and then adds a Test Libraries node and the JUnit library.

Creating the Java Classes

In this exercise you copy the files Utils.java and Vectors.java from the sample project
JUnitSampleSol into the class library project that you created.

1. In the Projects window, right-click the Source Packages node of the JUnit-
Sample project and choose New > Java Package from the popup menu.
2. Type sample as the package name. Click Finish.
3. Open the JUnitSampleSol project (if not already open) and expand the
Source Packages node in the Projects window.
1. Right
-click on tools and choose Tools >ests.
Create T
2. Select JUnit in the Framework dropdown list if not selected.
3. Select Test Initializer and Test Finalizer in the dialog box, if not selected.

1. Select JUnit 3.x in the Select JUnit Version dialog box.


When you select JUnit 3.x the IDE adds theJUnit 3 library to the project.

When you click Select, the IDE creates theVectorsJUnit3Test.java


test class in the samplepackage
under the Test Packages node in the Projects window.

1. Area code in java

 Test cases for Area of Triangle.


 Test cases for Area of Rectangle.
//Code
package junitp;

/**
*
* @author Admin
/*
* To change
this license
header, choose
License Headers
in Project
Properties.
* To change
this template
file, choose
Tools |
Templates
* and open the
template in the
editor.
*/
package
junittesting;

/**
*
* @author
admin
*/
public class
JunitTesting {
public static
void
main(String[]
args) {
String string
= "The best of
both worlds";
int count =
0;

//Counts
each character
except space
for(int i = 0;
i<
string.length();
i++) {

if(string.charAt(i
) != ' ')
count+
+;
}

//Displays
the total
number of
characters
present in the
given string

System.out.prin
tln("Total
number of
characters in a
string: " +
count);
}
}

//
JunitTestingTest
.java /*
* To change
this license
header, choose
License Headers
in Project
Properties.
* To change
this template
file, choose
Tools |
Templates
* and open the
template in the
editor.
*/
package
junittesting;

import
org.junit.After;
import
org.junit.AfterCl
ass;
import
org.junit.Before;
import
org.junit.Before
Class;
import
org.junit.Test;
import static
org.junit.Assert.
*;

/**
*
* @author
admin
*/
public class
JunitTestingTest
{

public
JunitTestingTest
() {
}

@BeforeClass
public static
void
setUpClass() {
}

@AfterClass
public static
void
tearDownClass()
{
}

@Before
public void
setUp() {
}
@After
public void
tearDown() {
}

/**
* Test of
main method,
of class
JunitTesting.
*/
@Test
public void
testMain() {

System.out.prin
tln("main");
String[] args
= null;

JunitTesting.mai
n(args);

}
To perform black box testing for all the units contained in the architectural
segments using Equivalence partitioning, Boundary value analysis and
Orthogonal Array testing methods. To study exploratory testing for the
module under test and merits/demerits of the technique

What is Black box testing?

Black-box testing is a method of software testing that examines the


functionality of an application without peering into its internal structures or
workings.

This method of test can be applied virtually to every level of software testing:
unit, integration, system and acceptance. It is sometimes referred to as
specification-based testing. Black box Testing techniques are given below.

1. Equivalence partitioning

2. Boundary Value Analysis

3. Orthogonal Array Testing

1. Equivalence Partitioning
Equivalence Partitioning Test case design technique is one of the testing
technique

Equivalence partitioning is also known as Equivalence class Partitioning.

In Equivalence Partitioning, inputs to the software or system are divided into


groups that are expected to exhibit similar behavior, so they are likely to be
proposed in the same way.

Hence selecting one input from each group to design the test cases.

Each and every condition of particular partition (group) work as same as


other. If a condition in a partition is valid, other conditions are valid too. If a
condition in a partition is invalid, other conditions are invalid too.

It helps to reduce the total number of test cases from infinite to finite. The
selected test cases from these groups ensure coverage of all possible
scenarios. Equivalence Partitioning is applicable at all levels of testing.

Example1:

Percentage (Accepts Percentage value between 50 to 90)

Enter percentage
Invalid Valid Invalid

<=49 50-90 >=91

Valid input: 50-90

Invalid input: less than or equal to 49 (<=49), greater than or equal to 91


(>=91)

Valid class: 50-90= pick any one input test data from 50-90

Invalid class 1: <=49 = pick any one input test data less than or equal to 49
Invalid class 2: >=91 = pick any one input test data greater than or

equal to 91 One valid condition and two invalid conditions

Example2:

Consider an OTP number that contains only 6 digit number, greater and even
less than six digits will not be accepted, and the application will redirect
customer or user to error page. If password entered by user is less or more
than six characters, that equivalence partitioning method will show an invalid
OTP. If password entered is exactly six characters, then equivalence
partitioning method will show valid OTP.

Example3:
Username(Accepts 6 to 20 character)

Enter character
Invalid Valid Invalid

<=6 6-20 >=21

Valid input: 6-20

Invalid input: less than or equal to 6 (<=6), greater than or equal to 21 (>=21)

Valid class: 6-20= pick any one input test data from 6-20

Invalid class 1: <=6= pick any one input test data less than or equal to 6
Invalid class 2: >=21 = pick any one input test data greater than or equal to 21

One valid condition and two invalid

conditions Example 4:

Date (Accepts Date value between 1 to 31)

Enter percentage
Invalid Valid Invalid

<1 1-31 >31

Valid input: 1-31

Invalid input: less than or equal to 49 (<1), greater than or equal to 91 (>31)

Valid class: 1-31= pick any one input test data from 1-31

Invalid class 1: <1 = pick any one input test data less than 1

Invalid class 2: >31 = pick any one input test data greater than 31

One valid condition and two invalid conditions

2. Boundary value analysis (BVA):

Boundary value analysis Test case design technique is one of the testing
techniques. Boundary value analysis (BVA) is based on testing the boundary
values of valid and invalid partitions.

The behavior of the edge of each equivalence partition is more likely to be


incorrect than the behavior within the partition, so boundaries are an area
where testing is likely to yield defects.

Every partition has its maximum and minimum values and these

The maximum and minimum values of a partition are its boundary values.

A boundary value for a valid partition is a valid boundary value. Similarly a


boundary value for an invalid partition is a invalid boundary value.
For each boundary we test +/-1 in the least significant digit of either side of
the boundary.

Boundary value analysis can be applied at all test levels.

Example1:

Enter Percentage
invalid valid invalid

Min-1 Min,+min,-max,max Max+1

49 50,51,89,90 91

Minimum boundary value is 50

Maximum boundary value is 90 Valid inputs:

50,51,89,90 Invalid inputs: 49 and 91 Test case1:

Enter the value 49(50-1) = invalid

Test case 2: Enter the value 50= valid

Test case 3: Enter the value 91 (90 + 1) =invalid

Test case 4: Enter the value 89 (90 – 1) = valid

Test case 5: Enter the value 90 = valid

Example2:

Enter username character length


invalid valid invalid

Min-1 Min,+min,-max,max Max+1

5 6,7,19,20 21

Minimum boundary value is 6


Maximum boundary value is 20

Valid inputs: 7,8,19,20

Invalid inputs: 5 and 21

Test case1: Enter the value 5(6-1) = invalid

Test case 2: Enter the value 6= valid

Test case 3: Enter the value 21 (20 + 1) = invalid

Test case 4: Enter the value 19(20 – 1) = valid

Test case 5: Enter the value 20 = valid

3. Orthogonal Array Testing

Orthogonal array testing is a method wherein, the test data is large and
consists of a number of permutations and combinations. It is a type of pair
wise testing. It gives the less number of test cases.

Orthogonal Array Techniques

Identify the independent variables

For each variable, identify the no. of possible values.

Search an OA with the smallest no. of rows.

Place the variable names in the OA columns.

Place the variable values in the OA cells.

If there are empty OA cells, cycle values in them.

𝐿𝑅𝑢𝑛𝑠(𝐿𝑒𝑣𝑒𝑙𝑠𝐹𝑎𝑐𝑡𝑜𝑟𝑠)
Runs(N): - number of rows in the array, which translates into a number of test
cases that will be generated.

Factors(K): - number of columns in the array, which translates into a


maximum number of variables that can be handled Levels(V): maximum
number of values that can be any single factor

Advantages of Orthogonal Array Testing: Less number of Test conditions which


requires less implementation time

Less execution time.

Easy analysis of test conditions due to less number of test conditions.

High coverage of codes Increased overall productivity and ensure that the
quality test is performed.

Limitations of Orthogonal Array Testing

Testing will fail if we fail to identify the good pairs Probability of not
identifying the most important combinations which can result in losing a
defect.

This technique will fail if we do not know the interactions between the pairs.
Applying only this technique will not ensure complete coverage. It can find
only these defects which arise due to pairs, as input parameters.
CITY SALESPERSON PRODUCT

MUMBAI BOB NOTEBOOK

DELHI JOY DESKTOP

BENGALURE ALICE MOUSE

4 variables= city(3 values), salesperson (3 values), Product(3 values) No of


combinations: 3*3*3=27
RUN CITY SALESPERSON PRODUCT

RUN1 MUMBAI BOB NOTEBOOK


RUN2 MUMBAI JOY DESKTOP

RUN3 MUMBAI ALICE MOUSE

RUN4 DELHI BOB KEYBOARD

RUN5 DELHI JOY CPU

RUN6 DELHI ALICE PRINTER

RUN7 BENGALURU JOY LAPTOP

4. Exploratory Testing:

What is Exploratory testing

As name suggests that the exploratory testing means testing of software


without any specific plans and schedules.

Identify the functionality of application by exploring the application

Testers design the test cases and simultaneously execute them as well This
testing has minimum planning and maximum execution.

When to do the Exploratory testing?

When you do not have a requirement document or very less documents.

When testing needs to be done in short period or time.

When you have to test the application in the early stage of SDL Merits of
Exploratory testing: This is a time saving technique because all task are
going on simultaneously like testing, designing test scenarios and
executing test scenarios. 73 It encourages creativity and intuition
Generation of new ideas during test execution Demerits of Exploratory
testing it depends on the tester experience, skills, and knowledge. Require
time to learn the application. Tester is more likely to miss if they know less
about the application Not appropriate for projects with long execution
time.
Ex: we check our application in different browser like chrome,firefox e.t.c to
check their functionality is working fine

PRACTICAL NO. 07
To perform Regression Testing / GUI Testing of the System under
construction with Unit and Integration profiles by using any Functional
Testing Tool.

What is regression testing?

REGRESSION TESTING is defined as a type of software testing to confirm that a


recent program or code change has not adversely affected existing features.

Regression Testing is nothing but a full or partial selection of already executed


test cases which are re-executed to ensure existing functionalities work fine.

This testing is done to make sure that new code changes should not have side
effects on the existing functionalities. It ensures that the old code still works
once the latest code changes are done.

For example
A website has a feature that allows you to upload images in JPEG and PNG
format but there is a bug causing one of the formats to fail to upload. When a
developer fixes this bug, a regression test must be performed to ensure that
the fix hasn’t affected the other features involved in the image-uploading
process.

Need of Regression Testing:

This testing is required when there is any:

• Change in requirements and code is modified as per the changed


requirements
• Added new features in product
• Bug fixing
• Fixing of performance related issues
Types of regression testing

The different types of Regression Testing are as follows:

o Unit Regression Testing [URT]


o Regional Regression Testing[RRT]
o Full or Complete Regression Testing [FRT]

Unit Regression
Testing [URT]

In this, we are going to test only the changed unit, not the impact area, because it may
affect the components of the same module.

Example1

In the below application, and in the first build, the developerSearch


develops
button
the
that accept
s 1-15characters
. Then the test engineer tests the Search button with the help
of thetest case design technique
.

Now, the client does some modification in the requirement and also requests that
theSearch button
can accept the
1-35characters. The test
engineer will test only the
Search button to verify that it -takes
35characters
1 and does not check any further feature
of the first build.

Example2
Here, we have
Build B001
, and a defect is identified, and the report is delivered to the
developer. The
eveloper
d will fix the bug and sends along with some new features which
are developed in the second
Build B002
. After that, the test engineer will test only after the
defect is fixed.

o The test engineer will identify that clicking


Submit
on button
the goes
o the
t blank
page.
o And it is a defect, and it is sent to the developer for fixing it.
o When the new build comes along with the bug fixes, the test engineer will test only
the Submit button.
o And here, we are not going to check other features
build
of the
andfirst
move to test
the new features and sent in the second build.
o We are sure that fixing
Submit
the button is not going to affect the other features, so
we test only the fixed bug.

Therefore, we can say that by testing only the changedled


feature
theUnitisRegression
cal
Testing

Regional Regression testing [RRT]


In this, we are going to test the modification along with the impact area or regions, are
called the
Regional Regression testing
. Here, we are testing the impact area because if
there are pendable
de modules, it will affect the other modules also.

For example:

In the below image as we can see that we have four differentModule modules, A,such as
Module B, Module C, and Module, whichDare provided by the developers for the testing
during the
first build. Now, the test engineer will identifyModule
the bugs
. DThe
in bug
report is sent to the developers, and the development team fixes those defects and sends
the second built

In the second build, the previous defects are fixed.engineer


Now theunderstands
test that
the bug fixing in Module D has impacted some Module
features
A and
in Module
. Hence,
C
the test engineer first tests the Module D where the bug has been fixed and then checks
the impact areas
Module
in A and Module
. Therefore,
C hist testing is known
Regional
as
regression testing.

Full Regression testing [FRT]

During the second and the third release of the product, the client
-4 new
asks for adding 3
features, and also some defects need to be fixed from the previous
he release. Then t
testing team will do the Impact Analysis and identify that the above modification will lead
us to test the entire product.
Therefore, we can say that testing
modified
the features
andall the remaining (old)
features
is called the
Full Regression testin
g

What are the techniques of Regression Testing?

Continuous software maintenance includes lot of activities such as enhancements, error


corrections, optimization etc. Due to these new changes system may start to work
incorrectly. In this case regression
testing is required to handle to new generated issues.
this testing can be performed using following techniques:

 Retest All:
Re execute all the tests in the existing test bucket. This requires huge time
and resources and that’s why it is very expensive.

When to apply Regression


 Regression Testing?the selected part of test suites
test selection:
Execute -usable
i.e. re
test
cases or obsolete test cases.
It is recommended to perform regression testing on the occurrence of the
 Test case
following prioritization:
events: Prioritization of test cases depends on business impact and
used functionalities.
1.When new functionalities are added
2.In case of change requirements

3.When there is a defect fix

4.When there are performance issues

5.In case of environment changes

6.When there is a patch fix

Benefits of regression testing

The basic idea of conducting this testing is to identify issues that might have
got developed because of the changes applied, In this case conducting
regression testing benefits in a number of ways such as:

• Increase possibilities of tracking bugs caused due to new changes


• Helps in researching unwanted side effects that might have been
occurred due to new operating environment
• Identify bugs and errors in early stage
• Extremely valuable in situations when constant changes are required in
the product

EXAMPLE

Program to calculate percentage and average of the subject marks using AWT.

Code:
import java.awt.*;

import java.awt.event.*;

class CalculateMarks implements ActionListener

Frame f = new Frame();

Label l1 = new Label("Math");


Label l2 = new Label("Science");

Label l3 = new Label("Computers");

Label l4 = new Label("English");

Label l5 = new Label("Average");

Label l6 = new Label("Percentage");

TextField t1 = new TextField();

TextField t2 = new TextField();

TextField t3 = new TextField();

TextField t4 = new TextField();

TextField t5 = new TextField();

TextField t6 = new TextField();

Button b1 = new Button("Calculate");

Button b2 = new Button("Exit");

CalculateMarks()

l1.setBounds(50,100,100,20);

l2.setBounds(50,140,100,20);

l3.setBounds(50,180,100,20);

l4.setBounds(50,220,100,20);

l5.setBounds(50,260,100,20);

l6.setBounds(50,300,100,20);

t1.setBounds(200,100,100,20);

t2.setBounds(200,140,100,20);

t3.setBounds(200,180,100,20);

t4.setBounds(200,220,100,20);

t5.setBounds(200,260,100,20);

t6.setBounds(200,300,100,20);
b1.setBounds(100,350,80,20);

b2.setBounds(200,350,50,20);

f.add(l1);

f.add(l2);

f.add(l3);

f.add(l4);

f.add(l5);

f.add(l6);

f.add(t1);

f.add(t2);

f.add(t3);

f.add(t4);

f.add(t5);

f.add(t6);

f.add(b1);

f.add(b2);

b1.addActionListener(this);

b2.addActionListener(this);

f.setLayout(null);

f.setVisible(true);

f.setSize(500,450);

public void actionPerformed(ActionEvent e)

float avg, percentage;

int n1 = Integer.parseInt(t1.getText());

int n2 = Integer.parseInt(t2.getText());
int n3 = Integer.parseInt(t3.getText());

int n4 = Integer.parseInt(t4.getText());

if(e.getSource() == b1)

float total = n1+n2+n3+n4;

avg = total / 4;

t5.setText(String.valueOf(avg));

percentage = ((total / 400) * 100);

t6.setText(String.valueOf(percentage));

if(e.getSource() == b2)

System.exit(0);

public static void main(String args[])

new CalculateMarks();

Output:

1. Check the multiplication functionality:


PRACTICAL NO.8

To perform Automated Testing using suitable CASE tools addressing Higher Order
testing strategies.

What is Automation Testing?


Automation Testing or Test Automation is a software testing technique that performs
using special automated testing software tools to execute a test case suite. On the other
hand, Manual Testing is performed by a human sitting in front of a computer carefully
executing the test steps. 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.

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:
Manual Testing of all workflows, all fields, all negative scenarios is time and money
consuming.
It is difficult to test for multilingual sites manually
Test Automation in software testing does not require Human intervention. You can run
automated test unattended (overnight)
Test Automation increases the speed of test execution
Automation helps increase Test Coverage Manual Testing can become boring and hence
error-prone.

Which Test Cases to Automate?


Test cases to be automated can be selected using the following criterion to increase the
automation ROI
High Risk – Business Critical test cases
Test cases that are repeatedly executed
Test Cases that are very tedious or difficult to perform manually
Test Cases which are time-consuming
The following category of test cases are not suitable for automation:
Test Cases that are newly designed and not executed manually at least once
Test Cases for which the requirements are frequently changing
Test cases which are executed on an ad-hoc basis.

Automated Testing Process:


Following steps are followed in an Automation Process Step
1) Test Tool Selection Step
2) Define scope of Automation Step
3) Planning, Design and Development Step
4) Test Execution Step
5) Maintenance
Following are the Test Automation benefit
1) Automation optimize the testing speed
2) Automation improves the testing quality
3) Automation reduces the cost of testing
4) Automation scripts can run at any time and any number of times

Types of Automated Testing


Smoke Testing
Unit Testing
Integration Testing
Functional Testing
Keyword Testing
Regression Testing
Data Driven Testing
Black Box Testing
First, make sure you have all the prerequisites to start writing your first login script using
Java and Selenium. You need to have the following:
Download and Install JDK (Java Development Kit).
Install Netbeans.
Download the Selenium Java Client version.
Driver executable: Depending upon the browser you wish to execute your script in, you
can choose to download its Selenium executable .
As you go down the page, various browsers like Chrome, Mozilla, Opera, and Edge drivers
will be available for download to help you perform automated cross-browser testing using
Selenium.
That is all. Open Netbeans and create your project. Add your Selenium jar in your Java
build path and you are good to go.
First, make sure you have all the prerequisites to start writing your first login script using
Java and Selenium. You need to have the following:
Download and Install JDK (Java Development Kit).
Install Netbeans.
Download the Selenium Java Client version.
Driver executable: Depending upon the browser you wish to execute your script in, you
can choose to download its Selenium executable .
As you go down the page, various browsers like Chrome, Mozilla, Opera, and Edge drivers
will be available for download to help you perform automated cross-browser testing using
Selenium.
That is all. Open Netbeans and create your project. Add your Selenium jar in your Java
build path and you are good to go.
Basic Steps For A Selenium Test Case
Create a Selenium WebDriver instance. i.e. Webdriver driver=new
ChromeDriver(); System.setProperty(“webdriver.chrome.driver”, “File path for the Exe”);
Configure your browser if required (for example, maximize browser, disable browser
notifications, etc.).i.e. driver.manage().window().maximize();
Selenium First Test Case :

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package stqaselenium;

/**

* @author Saylo

*/

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

public class STQASelenium {

public static void main(String[] args) {


// declaration and instantiation of objects/variables

System.setProperty("webdriver.chrome.driver", "C:\\Users\\Saylo\\OneDrive\\
Desktop\\STQA\\chromedriver_win32 (1)\\chromedriver.exe");

WebDriver driver=new ChromeDriver();

// Launch website

driver.navigate().to("https://www.instagram.com/accounts/login/");

// Click on the search text box and send value

driver.findElement(By.id("lst-ib")).sendKeys("instagram login");

// Click on the search button

driver.findElement(By.name("btnK")).click();

}
Selenium Second Test Case :

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package stqaselenium;

/**

* @author Saylo

*/

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

public class STQASelenium {

public static void main(String[] args) {

// declaration and instantiation of objects/variables

System.setProperty("webdriver.chrome.driver", "C:\\Users\\Saylo\\OneDrive\\
Desktop\\STQA\\chromedriver_win32 (1)\\chromedriver.exe");

WebDriver driver=new ChromeDriver();

// Launch website

driver.navigate().to("https://github.com/login");

// Click on the search text box and send value

driver.findElement(By.id("lst-ib")).sendKeys("github login");

// Click on the search button

driver.findElement(By.name("btnK")).click(); }}
PRACTICAL NO. 09

To perform Web Based Testing for Web Application incorporating any open source tool.
To study performance testing, load testing, security testing, stress testing, Demonstrate
on link Test expectation.
Performance Testing
“Performance Testing” is a software testing process used for testing the speed, response
time, stability, reliability, scalability and resource usage of a software application under
particular workload. The main purpose of performance testing is to identify and eliminate
the performance bottlenecks in the software application. It is a subset of performance
engineering and also known as “Perf Testing”.
The focus of Performance Testing is checking a software program’s Speed – Determines
whether the application responds quickly Scalability – Determines maximum user load the
software application can handle. Stability – Determines if the application is stable under
varying loads
Why do Performance Testing?
Features and Functionality supported by a software system is not the only concern. A
software application’s performance like its response time, reliability, resource usage and
scalability do matter. The goal of Performance Testing is not to find bugs but to eliminate
performance bottlenecks. Performance testing will determine whether their software
meets speed, scalability and stability requirements under expected workloads.
Applications sent to market with poor performance metrics due to nonexistent or poor
performance testing are likely to gain a bad reputation and fail to meet expected sales
goals.
Types of Performance Testing
Load testing – checks the application’s ability to perform under anticipated user loads.
The objective is to identify performance bottlenecks before the software application goes
live. Stress testing – involves testing an application under extreme workloads to see how
it handles high traffic or data processing. The objective is to identify the breaking point of
an application. Endurance testing – is done to make sure the software can handle the
expected load over a long period of time. Spike testing – tests the software’s reaction to
sudden large spikes in the load generated by users. Volume testing – Under Volume
Testing large no. of. Data is populated in a database and the overall software system’s
behavior is monitored. The objective is to check software application’s performance
under varying database volumes. Scalability testing – The objective of scalability testing is
to determine the software application’s effectiveness in “scaling up” to support an
increase in user load. It helps plan capacity additions to your software system.
Performance Testing Process
Identify your testing environment – Know your physical test environment, production
environment and what testing tools are available. Understand details of the hardware,
software and network configurations used during testing before you begin the testing
process. It will help testers create more efficient tests. It will also help identify possible
challenges that testers may encounter during the performance testing procedures
Identify the performance acceptance criteria – This includes goals and constraints for
throughput, response times and resource allocation. It is also necessary to identify project
success criteria outside of these goals and constraints. Testers should be empowered to
set performance criteria and goals because often the project specifications will not
include a wide enough variety of performance benchmarks. Sometimes there may be
none at all. When possible, finding a similar application to compare to is a good way to set
performance goals. Plan & design performance tests – Determine how usage is likely to
vary amongst end users and identify key scenarios to test for all possible use cases. It is
necessary to simulate a variety of end users, plan performance test data and outline what
metrics will be gathered. Configuring the test environment – Prepare the testing
environment before execution. Also, arrange tools and other resources. Implement test
design – Create the performance tests according to your test design.
Run the tests – Execute and monitor the tests.
Analyze, tune and retest – Consolidate, analyze and share test results. Then fine tune and
test again to see if there is an improvement or decrease in performance. Since
improvements generally grow smaller with each retest, stop when bottlenecking is caused
by the CPU. Then you may have the option of increasing CPU power.
Example Performance Test Cases
Verify response time is not more than 1000 secs when 1000 users access the website
simultaneously. Verify response time of the Application Under Load is within an
acceptable range when the network connectivity is slow Check the maximum number of
users that the application can handle before it crashes. Check database execution time
when 500 records are read/written simultaneously. Check CPU and memory usage of the
application and the database server under peak load conditions
Verify response time of the application under low, normal, moderate and heavy load
conditions.
Which Applications should we Performance Test?
Performance Testing is always done for client-server based systems only. This means, any
application which is not a client-server based architecture, must not require Performance
Testing. For example, Microsoft Calculator is neither client-server based nor runs multiple
users; hence it is not a candidate for Performance Testing.
Use Jmeter For Performance Testing
How to download Jmeter
1.https://jmeter.apache.org/download_jmeter.cgi
2.Go to binaries
3.for windows download zip file
How to open Jmeter
1.After installing go to bin folder
2.Click on JMeter (Window Batch File)
How to create test plan
Rkkht-click on test Plan
Click on add
Thread User
Thread Group

How to choose Listener


Go to add
Listener
Choose any Listener
Example of performance testing using jmeter
Practical No: 10

Installing Docker on Linux, Docker- Installation, Basic Docker Commands, working with
Containers.
Overview of Docker: Docker is a container management service. The keywords of Docker
are develop, ship and run anywhere. The whole idea of Docker is for developers to easily
develop applications, ship them into containers which can then be deployed anywhere.
The initial release of Docker was in March 2013 and since then, it has become the
buzzword for modern world development, especially in the face of Agile based projects
Features of Docker Docker has the ability to reduce the size of development by providing
a smaller footprint of the operating system via containers. With containers, it becomes
easier for teams across different units, such as development, QA and Operations to work
seamlessly across applications. You can deploy Docker containers anywhere, on any
physical and virtual machines and even on the cloud. Since Docker containers are pretty
lightweight, they are very easily scalable. Components of Docker
Docker has the following components
Docker for Mac − It allows one to run Docker containers on the Mac OS.
Docker for Linux − It allows one to run Docker containers on the Linux OS.
Docker for Windows − It allows one to run Docker containers on the Windows OS.
Docker Engine − It is used for building Docker images and creating Docker containers.
Docker Hub − This is the registry which is used to host various Docker images.
Docker Compose − This is used to define applications using multiple Docker containers.
The official site for Docker is https://www.docker.com/ The site has all information and
documentation about the Docker software. It also has the download links for various
operating systems.
DOCKER -INSTALL
Installing Docker on Linux System:
STEPS:
1. Install Docker
2. Start Docker
3. Stop Docker
4. Uninstall Docker
Before installing Docker, you first have to ensure that you have the right Linux kernel
version running. Docker is only designed to run on Linux kernel version 3.8 and higher.
DOCKER BASIC COMMANDS
1.Docker Version

2 info − It is used to ensure that the Docker command returns the detailed information on
the Docker service installed. The output will provide the various details of the Docker
installed on the system such as –
Number of containers
Number of images
The storage driver used by Docker
The root directory used by Docker
The execution driver used by Docker
3 docker –help
This command show you information of any other command
4 Docker Working With images
#docker image
Options Image − This is the name of the image which is used to run the container.
Return Value
This command show all the images present in the container.
#docker run hello-world
This command will download the hello-world image from docker hub Docker hub is the
open public repository where it contain several images
#docker images –a
This command show all the list of images
#docker images –q

5 Docker - Working with Containers


we will explore in detail what we can do with containers.
#docker top With this command, you can see the top processes within a container.
Syntax
docker top ContainerID
Options ContainerID − This is the Container ID for which you want to see the top
processes. Return Value
The output will show the top-level processes within a container.
#docker ps
This command show all the running container
#docker ps –a
This command show all the container list

Docker Working with system


# docker system df
This command show all the images container information involved in the system.

#docker system prune


This command remove all the stopped container and dangling images and networks not
used by at least one container

Practical no:11
Building a Web Server Docker File
In our example, we are going to use the Apache Web Server on Ubuntu to build our
image. Let’s follow the steps given below, to build our web server Docker file.
Step 1 − The first step is to build our Docker File. Let’s use vim and create a Docker File
with the following information.

The following points need to be noted about the above statements –


 We are first creating our image to be from the Ubuntu base image.
 Next, we are going to use the RUN command to update all the packages on the
Ubuntu system.
 Next, we use the RUN command to install apache2 on our image.
 Next, we use the RUN command to install the necessary utility apache2 packages on
our image.
 Next, we use the RUN command to clean any unnecessary files from the system.
 The EXPOSE command is used to expose port 80 of Apache in the container to the
Docker host.
 Finally, the CMD command is used to run apache2 in the background.

Now that the file details have been entered, just save the file.
Step 2 − Run the Docker build command to build the Docker file. It can be done using
the following command –

We are tagging our image as mywebserver. Once the image is built, you will get a
successful message that the file has been built.

Step 3 − Now that the web server file has been built, it’s now time to create a container
from the image. We can do this with the Docker run command.
The following points need to be noted about the above command –
 The port number exposed by the container is 80. Hence with the –p command, we are
mapping the same port number to the 80 port number on our localhost.
 The –d option is used to run the container in detached mode. This is so that the
container can run in the background.
If you go to port 80 of the Docker host in your web browser, you will now see that
Apache is up and running.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy