Stqa Lab Journal - Mc2146 Pise Sayali Kishor
Stqa Lab Journal - Mc2146 Pise Sayali Kishor
OF COMPUTER SCIENCE
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.
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
-10
Installing Docker on Linux, Docker- Installation, Basic 72-
Docker Commands, working with Containers. 77
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
It is cost effective
Code Generation: -
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.
INTRODUCTION
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
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.
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
5. Resource Planning
How can you test a product without any information about it? The answer is
Impossible.
You must learn a product thoroughly before testing it.
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?
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?
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.
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 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.
Test
Scripts
Simulator
s.
Test Data
Test Results/reports
Defect Report
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)
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
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.
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.
class LinearSearch{
1. int n = arr.length;
if (arr[i] == x)
3. return i;
// Driver code
6. int x = 10;
// Function call
8. if (result == -1)
9. System.out.print(
10. else
+ 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:
(u)Use of
variable
eg.:
x=a+1;
There are nine possible two letter combinations for’d’, 'k' and 'u'. Some are
bugs, some are suspicious and some are okay.
it.
then redefined.
uk: use-kill
Normal situation
uu: use-use
Normal situation
Types of 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.
Arrays: dynamically allocated arrays contain garbage unless they are initialized
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
Identifying viable paths between definition and usage pairs of data variables.
2) Using syntax
Example 1:-
1. x(){
3. while(c>5){
4. if (d<50)
7. }
statement s:
[X, S, S1]
statement number x
is DEF(S) x is USES
(S1)
variable contains.
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(){
3. while(c>5){
4. if (d<50)
7. }
8 print(a);} //use
variable a so on this
we can compute du
chain
[a,2,5]
[a,6,8]
import java.util.*;
main(String[] args) {
int fact =
1;
int i = 1;
}}
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
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,
2) All-paths means all paths in the control flow graph should be covered. , All
edges and all nodes.
3.all-p-uses coverage
4.all-c-uses/some-p-uses
5.all-p-uses/some-c-uses
6.all-uses coverage
(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
(i,2,6)
(i,2,7)
(i,2,10)
(i,7,10)
(sum,3,6)
(sum,3,10)
(sum,6,10)
(num,8,5)
(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)
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 :
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. 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++)
Example:-
2. Value Mutations:-
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:-
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.
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.
/**
*
* @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
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
1. Equivalence Partitioning
Equivalence Partitioning Test case design technique is one of the testing
technique
Hence selecting one input from each group to design the test cases.
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:
Enter percentage
Invalid Valid Invalid
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
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
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
conditions Example 4:
Enter percentage
Invalid Valid Invalid
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
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.
Every partition has its maximum and minimum values and these
The maximum and minimum values of a partition are its boundary values.
Example1:
Enter Percentage
invalid valid invalid
49 50,51,89,90 91
Example2:
5 6,7,19,20 21
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.
𝐿𝑅𝑢𝑛𝑠(𝐿𝑒𝑣𝑒𝑙𝑠𝐹𝑎𝑐𝑡𝑜𝑟𝑠)
Runs(N): - number of rows in the array, which translates into a number of test
cases that will be generated.
High coverage of codes Increased overall productivity and ensure that the
quality test is performed.
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
4. Exploratory Testing:
Testers design the test cases and simultaneously execute them as well This
testing has minimum planning and maximum execution.
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.
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.
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
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.
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
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
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.
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:
EXAMPLE
Program to calculate percentage and average of the subject marks using AWT.
Code:
import java.awt.*;
import java.awt.event.*;
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);
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)
avg = total / 4;
t5.setText(String.valueOf(avg));
t6.setText(String.valueOf(percentage));
if(e.getSource() == b2)
System.exit(0);
new CalculateMarks();
Output:
To perform Automated Testing using suitable CASE tools addressing Higher Order
testing strategies.
/*
*/
package stqaselenium;
/**
* @author Saylo
*/
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Saylo\\OneDrive\\
Desktop\\STQA\\chromedriver_win32 (1)\\chromedriver.exe");
// Launch website
driver.navigate().to("https://www.instagram.com/accounts/login/");
driver.findElement(By.id("lst-ib")).sendKeys("instagram login");
driver.findElement(By.name("btnK")).click();
}
Selenium Second Test Case :
/*
*/
package stqaselenium;
/**
* @author Saylo
*/
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Saylo\\OneDrive\\
Desktop\\STQA\\chromedriver_win32 (1)\\chromedriver.exe");
// Launch website
driver.navigate().to("https://github.com/login");
driver.findElement(By.id("lst-ib")).sendKeys("github login");
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
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
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.
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.