You are on page 1of 125

Established as per the Section 2(f) of the UGC Act, 1956

Approved by AICTE, COA and BCI, New Delhi

Software Testing and Quality Assurance-M21DES323

Unit-03

School of CSA
Pinaka Pani. R
Assitant Professor
Outline

• Path Testing
• Control Flow Graph
• DD-Path Fraph
• Questions
Path testing

• Structural testing method


• Based on the source code / pseudocode of the program or the system, and
NOT on its specification
Example: Find the Control Flow Graph (CFG)
for the Triangle Problem
CFG
CFG
DD – Path Graph

• A CFG can be broken into DD-paths


• The resulting graph is called a DD-path graph of the program
DD – Path Graph

DD: Decision – to – Decision path


• A DD-path is a sub-path in a program graph fulfilling one of the conditions below:
1. It consists of a single node with indeg = 0
2. It consists of a single node with outdeg = 0
3. It consists of a single node with indeg ≥ 2 or outdeg ≥ 2
4. It consists of a single node with indeg = 1 and outdeg = 1
5. It is a maximal chain of length ≥ 1
DD – Path Graph

Node DD- Case of


Path Definition
Name
1 Source 1
2-4 A 5
5 B 3
6 C 4
7 D 4
8 E 3
… … …
19 Sink 2
CFG to DD-Path
Independent (basis) paths

Independent path is a path through a DD-path graph of the program which


cannot be reproduced from other paths by
– Addition (i.e. one path following another)
– Repetition (e.g. loop)
Independent (basis) paths
Independent (basis) paths
Objectives

• Dataflow Testing
• Static Data Flow Testing
• Dynamic Data Flow testing

• Define/USE Testing
• Data Flow Testing : Key Steps
• Example Commission problem
• Data Flow Testing Strategies
Data flow Testing
• A structural or White box testing technique
• Focuses
Variables are defined and used at different points within the
program.
• Motivations of data flow testing
The memory location for a variable is accessed in a
“desirable” way.
Verify the correctness of data values “defined” (i.e.
generated) – observe that all the “uses” of the value produce the
desired results
• In short each data variable is tracked and its use is verified.
• This approach tends to uncover bugs like variables used but
not initialize, or declared but not used, and so on
Contd…
• Data flow testing can be performed at two conceptual levels.
– Static data flow testing
– Dynamic data flow testing

• Static data flow testing


– Identify potential defects, commonly known as Data Flow Anomaly.
– Analyze source code.
– Do not execute code.
• Dynamic data flow testing
– Involves actual program execution.
– Bears similarity with control flow testing.
• Identify paths to execute them.
• Paths are identified based on data flow testing
criteria
Static Data flow testing
• Static analysis
refers to the finding faults in source code without
executing the program.
• Data flow anomaly
Anomaly: It is an abnormal way of doing something.
Ex : The second definition of x overrides the first.
x = f1(y);
x = f2(z);
Three define/reference anomalies
1. A variable that is defined but never used (referenced).
2. A variable that is used but never defined.
3. A variable that is defined twice before it is used
• Data flow anomaly can occur due to programming errors
Dynamic Data Flow Testing
There are two major forms of data flow testing
1. Define/Use testing
– paths to the locations and properties of references to
variables within the program code.
– a program can be analyzed in terms of
• how the variables are affected,
• assigned and
• changed throughout the course of the program.
2. Slice- Based Testing
– “Slice” the program into a number of individually
executable components
– Each focusing on one particular variable at one particular
location within the program.
– Slicing techniques which, especially on larger projects with
large teams of developers
Define / Use Testing-Terminology
• Nodes correspond to program statements

• Edges correspond to the flow of information

• Flow Program Graph G(P) : with respect to program(P)


 Single entry & exit nodes
 no edges from node to itself

• Set of program variables : V

• Set of all paths in P : paths(P)


Defining Node
• Node n G(P) is a defining node of the variable v 
V, written as DEF(v, n)
iff the value of the variable v is defined at the statement
fragment corresponding to node n.

• Defining Statements include


 Input statements (e.g., read) Ex : Input (x)
 Assignments statements Ex : x = 20
 Conditional statements
 Loop control statements
 Procedure calls

• The contents of the memory locations related to the


variables are changed.
Usage Node
• Node n G(P) is a usage node of the variable v  V, written as
USE( v , n) iff
the value of the variable v is used at the statement fragment
corresponding to node n.

• Usage Statements include


 Output statements (e.g., write) Ex : ouput(x)
 Assignments statements (R.H.S.) Ex : a = 20 + x;
 Conditional statements Ex : if x==5
 Loop control statements
 Procedure calls

• The contents of the memory locations related to the variables are


unchanged

• A usage node USE(v, n) is either


– a predicate use (denoted by P-use)
– Or, a computation use (denoted by C-use)
An example y
(x )
1. scanf(x, y); if(y < 0) 1 def = {x, y} p-use : c-use = {}
2. pow = 0 – y; def = y y
3. else pow = y; 2 3 def = {pow}:c-
{pow}:
4. z = 1.0; c-use = use = {y}
5. while(pow != 0) 4 def = {z}: p-use = {}
{y}
6. { z = z * x; pow = pow – 1;
}
5 def = {}: c-use = {}
7. if ( y < 0 )
8. z = 1.0/z; powpow
6 7 def = {}: c-use = {}
9. printf(z); def = {z, y y
pow}: 9 def = {}:
8
c-use =def
{x,=z,{z}: c-use = {z}
pow} c-use = {z}
Definition-use and Definition clear
• Definition-use (du path) : w.r.t. a variable v (denoted
du-path) is a path in PATHS(P) such that for some vV,
there exist both defined and usage nodes such that
• DEF(v , m)
• USE(v , n) Where m is initial node and n is final nodes

• Definition-clear (dc-path): w.r.t. a variable v (denoted


dc-path) is a definition use path in PATHS(P) with initial
and final nodes DEF(v, m) and USE (v, n)
• such that no other node in the path is a defining
node of v.
The significant of DU-Paths and DC-Paths

• Du-paths and dc-paths capture the essence of computing with stored data
values

• Du-Paths and dc-Paths describe the flow of data across source statements
from the locations.
• where the values are defined to the locations

• where the values are used.


Data Flow Test Cases for Commission problem
• Checks the correctness of the du-paths in a Control
• Flow Graph of a program
• Test case definitions based on four groups of coverage
• All definitions
• All c-uses
• All p-uses
• All du-paths
Ex : Commission Problem
 Rifle salesperson sold rifle locks, stocks, and barrels
• Locks cost $45.00,
• stocks cost $30.00, and
• barrels cost $25.00.
At the end of each month, the company computed commission as follows:
• 10% on sales up to $1000
• 15% on the next $800
• 20% on any sales in excess of $1800.
Data Flow testing: key steps

Given a code (program or pseudo-code)


1. Number the lines
2. List the variables
3. List occurrences & assign a category to each variable
4. Identify du-pairs and their use (p- or c- )
5. Define test cases, depending on the required coverage
STEP 1 :Commission problem implemented in C language
1. //Program 4: (Dataflow Testing for commission calculation)
2. #include<stdio.h>
3. int main()
4. {
5. int locks, stocks, barrels, tlocks, tstocks, tbarrels;
6. float lprice,sprice,bprice,lsales,ssales,bsales,sales,comm;
7. lprice=45.0;
8. sprice=30.0;
9. bprice=25.0;
10. tlocks=0;
11. tstocks=0;
12. tbarrels=0;
13. printf("\n Enter the number of locks and to exit the loop. Enter -1 for locks\n");
scanf("%d", &locks);
14. while(locks != -1) {
15. printf("enter the number of stocks and barrels\n"); scanf("%d%d",&stocks,&barrels);
16. tlocks=tlocks+locks;
17. tstocks=tstocks+stocks;
18. tbarrels=btarrels+barrels;
19. printf("\nenter the number of locks and to exit the loop enter -1 for locks\n");
scanf("%d",&locks);
20. }
Commission problem Contd…
21. printf("\ntotal locks = %d\”,tlocks);
22. printf(“total stocks =%d\n”,tstocks);
23. printf(“total barrels =%d\n",tbarrels);
24. lsales = lprice*tlocks;
25. ssales=sprice*tstocks;
26. bsales=bprice*tbarrels;
27. sales=lsales+ssales+bsales;
28. printf("\nthe total sales=%f\n",sales);
29. if(sales > 1800.0)
30. {
31. comm=0.10*1000.0;
32. comm=comm+0.15*800;
33. comm=comm+0.20*(sales-1800.0);
}
34. else if(sales > 1000)
35. {
36. comm =0.10*1000;
37. comm=comm+0.15*(sales-1000);
}
38. else
39. comm=0.10*sales;
40. printf("the commission is=%f\n",comm);
41. return 0;
42. }
Program Graph for Commission Problem
7 8 9 10 11 12 13
14
15 16 17 18 19 20

21 22 23 24 25 26 27 28

2
30 9 3
3 4 3
3
1 5 8
3 3
2 6 3
3 3
9
3 7 4
0
4 4
Step 2 and 3 : Define/Use Nodes for variable in the commission
problem
Variable name Defined at node(P-use) Used at Node(C-use)
lprice 7 24
sprice 8 25
bprice 9 26
tlocks 10 , 16 16 , 21 , 24
tstocks 11 , 17 17 , 22 , 25
tbarrels 12 ,18 18 , 23 , 26
locks 13 , 19 14 , 16
stocks 15 17
barrels 15 18
lsales 24 27
ssales 25 27
bsales 26 27
27 28 , 29 , 33 , 34 ,37 , 39
sales
31 , 32 , 33 , 36 , 37 , 39 32 , 33 , 37 , 42
comm
Step 4 : identify du-pairs and their use (p- or c- )
Variable Path(Beginnin Definition-
du-path
name g , End nodes Clear
<7-8-9-10-11-12-13-14-15-16-
lprice (7 , 24) Yes
17-18-19-20-21-22-23-24>
<8-9-10-11-12-13-14-15-16-17-
Sprice (8, 25) 18-19-20-21-22-23-24-25>
YES

(10 , 16) <10-11-12-13-14-15-16> Yes

<10-11-12-13-14-15-16-17-18- NO
(10 , 21) 19-20-14-21>

total <10-11-12-13-14-15-16-17-18-
(10 , 24) NO
locks 19-20-14-21-22-23-24>
(16 , 16) <16-16> Yes
(16 , 21) <16-17-18-19-14-21> NO
(16 , 24) <16-17-18-19-20-14-21-22-23-24> NO
Step 4 : Identify du-pairs and their use (p- or c- ) Contd…
Variable Path(Beginning Definition-
du-path
name , End nodes Clear
(13 , 14) <13-14> Yes
( 13 , 16) <13-14-15-16> Yes
Locks (19 , 14) <19-20-14> Yes
(19 , 16) <19-20-14-15-16> Yes
(27 ,28) <27-28> Yes
(27 , 29) <27-28-29> Yes
(27 , 33) <27-28-29-30-31-32-33> Yes
Sales
(27 , 34) <27-28-29-34> Yes
(27 , 37) <27-28-29-34-35-36-37> Yes
(27 , 39) <27-28-29-34-38-39> Yes
( (31,32,33),42) <31-32-33-42> Yes
comm ((34 , 35) , 42) <34-35-42> Yes
((39 , 42 ) <39 - 42> Yes
Step 5 : Define the test cases
• All-c-uses
To achieve 100% All-c-uses data flow coverage at least one sub-
path from each variable definition to every c-use of that definition
must be executed.
• All-p-uses
To achieve 100% All-p-uses data flow coverage at least one sub-
path from each variable definition to every p-use of that definition
must be executed.
• All-uses
To achieve 100% All-uses data flow coverage at least one sub-
path from each variable definition to every use of that definition (both
p- and c- use) must be executed.
• All-du-paths
To achieve 100% All-du-paths data flow coverage every simple
sub-path from each variable definition to every use of that definition
must be executed.
Data Flow Testing Strategies

• Data flow testing is indicated in


– Computation-intensive applications
– “long” programs
– Programs with many variables

• A definition-clear du-path represents a small


function that can be tested by itself.

• If a du-path is not definition-clear, it should


be tested for each defining node.
10. tlocks=0; Test cases
11. tstocks=0; 18. tbarrels=btarrels+barrels;
12. tbarrels=0; 19. printf("\nenter the number of locks
13.printf("\nenter the number of locks and to exit the loop enter -1 for
and to exit the loop enter -1 for locks\n"); scanf("%d“ ,&locks);
locks\n"); scanf("%d", &locks); 20. }
14.while(locks!=-1) { 21. printf("\ntotal locks = %d\”,tlocks);
15.printf("enter the number of stocks 22. printf(“total stocks =%d\n”,tstocks);
and barrels\n"); scanf("%d%d", 23. printf(“total barrels =%d\n",tbarrels);
&stocks, &barrels); 24. lsales = lprice*tlocks;
16. tlocks=tlocks+locks;
17. tstocks=tstocks+stocks;
Varia Du –path Du - Path locks Stocks barrels Total
-ble clear locks
(10 , 21) NO <10-11-12-13-14-15-16-17- 20 30 40 20
total 18-19-20-14-21>
locks <10-11-12-13-14-15-16-17- 30 40 50 30
(10 , 24) NO
18-19-20-14-21-22-23-24>
(16 , 21) NO <16-17-18-19-14-21> 20 30 35 50
Conclusion
• Data flow Testing
– Select paths to be executed based on data flow analysis
– Information about where
• variables are defined
• variables are used
– Idea is to make sure that the definitions of variables and their
subsequent use is tested
– strategies span the gap between all paths and branch testing.
Upper-Level SATM Finite State Machine
PIN entry Finite State Machine
Decomposition tree for the STAM System
• When you begin implementing a software testing strategy for your
application, one of the first questions you’ll ask yourself is…..
System testing vs. Integration testing system.
• System testing is a testing level in which tests are performed to know if a
complete build align with functional and nonfunctional requirements made
for it.
• Integration testing is a testing stage where two or more software units are
joined and tested simultaneously.
What is System Testing?
• A system test inspects every software unit to secure their proficiency as a whole
or assembled build.
• In software engineering, a system test takes place after unit and integration
testing.
• The QA team tests critical checkpoints in the overall process to determine
whether business objectives are being met.
• Therefore, the complete system gains disapproval or approval for the final
evaluation in acceptance testing before going into widespread use by users.
• Developers report all system errors and decide the type and amount of errors
that can be permitted.
When is System Testing Done?
• The primary purpose of system testing is to examine the build’s
functionality.
• During the development of each software version.
• During the application launch, through alpha and beta testing.
• When unit and integration testing are complete.
• When the desired requirements are complete.
• When specified testing conditions are designed.
• This test level also checks the software’s conformity to user demands,
functional performance, and design.
What Tests are Carried out in System Testing?
• Here are some of the nonfunctional and functional tests used for executing
a system evaluation.
• Functional testing, including unit, integration, and acceptance tests
• Nonfunctional testing, including security, usability, load, compliance, stress,
and performance tests.
What are the Differences between Integration Testing and System Testing?

System Tests Integration Tests


To guarantee that the total To guarantee that joined
Intention build fulfills the business units can act together
specifications. without problems.
Nonfunctional and
Functional type of test. It’s
functional type of test. It
Type not in the acceptance
falls in the acceptance
testing class.
testing class.
White and black box testing
Technique Black box testing
or gray box testing
Helps to identify system Helps to identify interface
Value
errors. errors.
Teams involved Developers and Testers QA
How is System Testing Done?
• System testing is carried out as follows:
• Test plan: Create a test plan, including test cases and use cases.
• Test data: Create test data and perform an automated test, followed by a
manual test.
• Test results: Review the test result and write a report based on it. Log the
errors and carry our regression testing after reporting the errors.
• Debug: Fix the errors found in the system.
• Recycle: Repeat the cycle and stop when all errors have been removed.
What is Integration Testing?
• The term “integration” means a process of combining into an integral
whole. Similarly, integration testing of a build indicates separate testing
units of a system as one.
• The purpose is to find out if these combined units interact without issues.
By doing an integration test, testers can recognize errors between joined
units.
When is Integration Testing Done?
The appropriate timing and conditions are…
• To check the performance or engagement of several integrated units.
• To check if the intractable interface between such units contains some
errors.
• External systems developed by different developers may have different
communication setup.
Top Down

Procedure: Test the up modules and extend testing to the down levels.
•Aim: Check if up modules function as expected.
Merits
• Focuses on the core business processes.
• Tester can test by priority and find larger errors in the design.
• Early provision of Prototypes possible.
Demerits
• The modules at the lower level are insufficiently tested, and the specific
errors there may be discovered too late.
Top Down

1. Top-down
Bottom-up

Procedure: Test from the down modules to the up modules.


• Aim: Check if up modules work as intended.
• Tool: Drivers are used to create up units.
Merits
• Smaller code units at lower levels can be tested comprehensively and
interactively at an early stage and independently complete the “large” modules.
• Efficient division of the tests among different teams.
Cons
• The modules on the top level are tested insufficiently or too late so that despite
good integration on the lower levels, the essential interfaces on the higher levels
remain untested.
Bottom-up
.
Test Automation Tools & their Benefits

 Overview
 History of Testing
 What is Software Test Automation?
 Why is Software Test Automation Important?
 Software Test Automation Process
 Approach to Test Automation
 Types of automation framework
 Classification of Software Test Tools
 Test Automation and Tools for Software
 Benefits of Automation
Automation Testing

Automation is the use of tools and


strategies that reduce human involvement
or interaction in unskilled, repetitive or
redundant tasks.
History of Testing
History of Testing

• Four main phases in testing methodology:


– Debugging (1950’s)
– Exhaustive Testing/Prove it Works (1960’s)
– Prove it Does Not Work (1970’s)
– Defect Prevention & Testing Process (1980’s)
What is Software Test Automation?
Software test automation refers to the activities and efforts that intend to automate
engineering tasks and operations in a software test process using well-defined
strategies and systematic solutions.

The major objectives of software test automation:


• To free engineers from tedious and redundant manual testing operations.
• To speed up a software testing process, and to reduce software testing cost and
time during a software life cycle.
• To increase the quality and effectiveness of a software test process by achieving
pre-defined adequate test criteria in a limited schedule.
• The major key to the success of software automation is to reduce manual testing
activities and redundant test operations using a systematic solution to achieve a
better testing coverage.
Importance of Automation

 Using Testing Effectively

 Reducing Testing Costs

 Replicating testing across different platforms

 Greater Application Coverage

 Results Reporting
Plan Software Software Test Automation
Test Automation Process

Design Test Automation Select and Evaluate Available


Strategies & Solutions Software Testing Tools

Develop & Implement Test


Automation Solutions

Introduce and Deploy Test


Automation Solutions

Review and Evaluate


Software Test Automation
Approach to Test Automation

There are two general approaches to test automation:


 Code-driven testing. The public (usually) interfaces to classes,
modules or libraries are tested with a variety of input arguments to
validate that the results that are returned are correct.

 Graphical user interface testing. A testing framework generates


user interface events such as keystrokes and mouse clicks, and
observes the changes that result in the user interface, to validate
that the observable behavior of the program is correct.
Code-driven testing
 Code driven test automation is a key feature of agile software
development, where it is known as test-driven development.
 Unit tests are written to define the functionality ''before'' the code is
written. Only when all tests pass is the code considered complete.
 A growing trend in software development is the use of testing
frameworks such as the xUnit frameworks (for example, Junit for JAVA
and Nunit for .Net languages) that allow the execution of unit tests to
determine whether various sections of the code are acting as expected
under various circumstances.
 Test cases describe tests that need to be run on the program to verify that
the program runs as expected.
Graphical User Interface (GUI) testing
 Many test automation tools provide record and playback features that
allow users to interactively record user actions and replay them back any
number of times, comparing actual results to those expected. The
advantage of this approach is that it requires little or no software
development.

 This approach can be applied to any application that has a graphical user
interface. However, reliance on these features poses major reliability and
maintainability problems.

 A variation on this type of tool is for testing of web sites. Here, the
"interface" is the web page. However, such a framework utilizes entirely
different techniques because it is reading HTML instead of observing
window events.
Different types of Automation Frameworks
The frameworks are categorized on the basis of the
automation component they leverage.

 Data-driven testing
 Modularity-driven testing
 Keyword-driven testing
 Hybrid testing
 Model-based testing
Automation Testing Tools

Categories of automation testing tools.


 Unit testing tools.
 System application Functional/Regression testing tools.
 Web application testing tools.
 Load and Performance testing tools.
 Mobile application testing tools.
List of Functional/GUI testing tools
 Selenium : Testing tool for browser-based testing of web applications. It can be used both
for functional, compatability (it has extensive cross-browser support) and regression testing.
Requirement: Windows, Linux or Mac

Open Source GUI testing tools


 Watir : Watir (Web Application Testing in Ruby) is a functional testing tool for web
applications. It supports tests executed at the web browser layer by driving a web browser
and interacting with objects on a web page. It uses the Ruby scripting language.
Requirement: Windows (currently only supports Internet Explorer)

 Maveryx : Maveryx is a free and open source Test Automation Framework for functional
and regression testing of Java applications. Maveryx eliminates the GUI Map dependency.
Maveryx supports approximate matching to identify the GUI objects even in case of few or
partial information given by the tester in the test scripts. Maveryx works with Eclipse,
NetBeans, JUnit, IBM Rational Functional Tester, etc.
Requirement: OS Independent

 Capedit : Capedit is a open-source packet modification tool. It is used for protocol testing.
This tool has some unique features like stream based packet field modification, packet
deletion/duplication/reordering, IP and MAC address find and replace, auto checksum for
IP/ICMP/IGMP/TCP/UDP.
Proprietary GUI testing tools
 “AutoIt” - Microsoft Windows GUI Testing. Free of charge but not open source.

 “GUIdancer” by “Bredex” – Tool for Java (Swing, RCP/SWT, GEF) and HTML web testing.

 “HP QuickTest Professional” by ”Hewlett-Packard” (formerly by Mercury Interactive) - Tool


for functional/regression testing

 “HP WinRunner” by ”Hewlett-Packard”

 “HP LoadRunner®” - Enterprise load testing, by ”Hewlett-Packard”

 “IBM Rational Robot” by “IBM” – Tool for functional testing of client/server applications

 “IBM Rational Functional Tester” by ”IBM” - Tool for functional/regression testing.

 “IBM Rational Performance Tester” by “IBM” – Tool for performance testing

 “QF-Test” by “Quality First Software” - Tool for Java/Swing, Eclipse/SWT and HTML only
 “SilkTest” by ”Micro Focus International” - Tool for functional and regression testing

 “SilkPerformer” - Automated load and performance testing by ”Micro Focus International”

 “Soatest” (absorbed WebKing starting in version 6.0) by ”Parasoft”

 “froglogic's Squish” – Tool for object-based cross-platform, cross-GUI-technology testing

 “Telerik Test Studio” by “Telerik” – Tool for Load, Performance, System and mobile automation
testing

 ”Visual Studio Test professional” – Tool for UI testing using Test Automation FX by Windows

 “TestComplete” by ”SmartBear Software” - Tool for functional/regression testing

 “TOSCA Testsuite” by TRICENTIS Technology & Consulting

 “Ranorex” automated testing software – Tool for web, desktop and mobile apps
Best Tools for Test Automation
1. QTP - HP-QuickTest Professional
2. Watir
3. TOSCA Test Suite
4. Selenium
5. Visual Studio Test Professional
6. WebUI Test Studio
7. Rational Functional Tester
8. Test Complete
9. Test partner
10. SOA Test
11. Test Drive
Automated Testing Tools

• xUnit

• Selenium

• Test Complete

• Custom
xUnit
 xUnit is the white box automation testing framework.
 Frameworks based on the design by Kent Beck - (born 1961) is an
American software engineer and the creator of extreme
programming.
 Originally implemented for SmallTalk as SUnit.
 Partial List of Frameworks
◦ NUnit (.net)
◦ JUnit (java)
◦ CUnit ( C )
◦ CPPUnit (C++)
◦ SUnit (SmallTalk)
 xUnit test execution
◦ Setup
◦ Test body
◦ Teardown
xUnit architecture
All xUnit frameworks share the following basic component architecture, with some varied implementation details.
 Test case
This is the most elemental class. All unit tests are inherited from here.
 Test fixtures
A test fixture (also known as a test context) is the set of preconditions or state needed to run a test. The developer
should set up a known good state before the tests, and return to the original state after the tests.
 Test suites
A test suite is a set of tests that all share the same fixture. The order of the tests shouldn't matter.
 Test execution
The execution of an individual unit test proceeds as follows:
/* First, we should prepare our 'world' to make an isolated environment for testing */
setup();
...
/* Body of test - Here we make all the tests */
...
/* In the end, whether succeed or fail we should clean up so that other tests or code is not corrupted */
teardown();
The setup() and teardown() methods serve to initialize and clean up test fixtures.
 Assertions
An assertion is a function or macro that verifies the behavior (or the state) of the unit under test. Failure of an assertion
typically throws an exception, aborting the execution of the current test.
Selenium
 Testing tool for web applications.
 Comes in API and tool form.
 Supports:
◦ Windows: IE, Firefox, Seamonkey browser, Opera
◦ Mac OS X: Safari, Firefox, Camino, Seamonkey
◦ Linux: Firefox, Konqueror
 Can create tests using the Selenium library in many languages
(Java, .NET, Perl, Python, HTML and Ruby)
 Can create tests using their Selenium IDE which is implemented
as a Firefox extension.
◦ Once created in Firefox, the tests can be run in any of the supported
browsers.
Selenium Components

 Selenium-IDE

 Selenium-RC (Remote Control)

 Selenium-Grid
Selenium-IDE
• Integrated Development Environment for building Selenium test cases.
• Operates as a Firefox add-on and provides an interface for developing and running
individual test cases or entire test suites.
• Selenium-IDE has a recording feature, which will keep account of user actions as they are
performed and store them as a reusable script to play back.
• It also has a context menu (right-click) integrated with the Firefox browser, which allows
the user to pick from a list of assertions and verifications for the selected location.
• Offers full editing of test cases.
• Although it is a Firefox only add-on, tests created in it can also be run against other
browsers by using Selenium-RC & specifying the name of the test suite on the command
line.
Selenium Remote Control

• Selenium-RC provides an API (Application Programming Interface)


and library for each of its supported languages: HTML, Java, C#, Perl,
PHP, Python, and Ruby.

• This ability to use Selenium-RC with a high-level programming


language to develop test cases also allows the automated testing to be
integrated with a project’s automated build environment.
Selenium-Grid
Selenium-Grid allows the Selenium-RC solution to scale for test suites or
test suites to be run in multiple environments.

• With Selenium-Grid multiple instances of Selenium-RC are running on


various operating system and browser configurations, each of these when
launching register with a hub. When tests are sent to the hub they are
then redirected to an available Selenium-RC, which will launch the
browser and run the test.

• This allows for running tests in parallel, with the entire test suite
theoretically taking only as long to run as the longest individual test.
Steps to start with Selenium!
1) Begin: write and run tests in Firefox.
Selenium IDE is a Firefox add-on that records clicks, typing, and other
actions to make a test, which you can play back in the browser.

2) Customize: your language, your browser.


Selenium Remote Control (RC) runs your tests in multiple browsers and
platforms. Tweak your tests in your preferred language.

3) Deploy: scale out, speed up


Selenium Grid extends Selenium RC to distribute your tests across
multiple servers, saving you time by running tests in parallel.
Supported Browsers
*Tests developed on Firefox via Selenium-IDE can be executed on any
other supported browser via a simple Selenium-RC command line.
Browser Selenium-IDE Selenium-RC Operating Systems

1.0 Beta-1 & 1.0 Beta-2:


Firefox 3 Start browser, run tests Windows, Linux, Mac
Record and playback tests

1.0 Beta-1: Record and


Firefox 2 Start browser, run tests Windows, Linux, Mac
playback tests
IE 8 Under development Windows
Test execution only via
IE 7 Start browser, run tests Windows
Selenium-RC
Test execution only via
Safari 3 Start browser, run tests Mac
Selenium-RC
Test execution only via
Safari 2 Start browser, run tests Mac
Selenium-RC
Test execution only via
Opera 9 Start browser, run tests Windows, Linux, Mac
Selenium-RC
Test execution only via
Opera 8 Start browser, run tests Windows, Linux, Mac
Selenium-RC
Test execution only via
Google Chrome Start browser, run tests Windows
Selenium-RC(Windows)
Test execution only via
Others Partial support possible As applicable
Selenium-RC
Selenium Commands – Selenese
1) Actions are commands that generally manipulate the state of the application. They
do things like “click this link” and “select that option”.
• Can be called with “AndWait” suffix, e.g. “clickAndWait”.

2) Accessors examine the state of the application and store the results in variables,
e.g. “storeTitle”.
• They are also used to automatically generate Assertions.

3) Assertions are like Accessors, but verify that the state of the application conforms
to what is expected. Eg. “make sure the page title is X”, “verify that this checkbox
is checked”.

• All Selenium Assertions can be used in 3 modes: “assert”, “verify”, and ”


waitFor”. For example, you can “assertText”, “verifyText” and “waitForText”.
Selenium IDE

The list of

actions in the

actual test
case
to
execute
The root of web
application you
want to test
Selenium IDE
Execution
Commands Record test
actions

Try the test in


the Web based
TestRunner

Reference of the
currently selected
Specify commands,
command
including asserts
Test Suite
Executi
on
Control

Test Cases

Steps of
the
test case

Application
being tested
TestRunner Control
TestRunner Control Pause/Play
Run Selected Test Execution

Step through
Execution
Run All Tests
Control Speed
of Execution

Highlight Summary of
Elements in the the Test
Execution

View the log of


View the DOM of the the current
current Page being tested execution
Test Complete
 TestComplete is an automated testing tool, developed by SmartBear Software which aims to
allow testers to create software quality tests.
 Main Features
1. Keyword Testing
2. Full-Featured Script Editor
3. Test Record and Playback
4. Script Debugging Features
5. Access to Methods and Properties of Internal Objects
6. Unicode Support
7. Issue-Tracking Support
8. COM-based, Open Architecture
9. Test Visualizer
10. Support for plugins
 Supported OS
Microsoft Windows 2000, XP, Server 2003, Server 2008, Vista, Windows (both 32-bit and 64-
bit editions)
Custom

• Write your own custom testing environment or API.


• Used when you have very specific testing needs.
• Often used for embedded systems.
Benefits of Automation Testing
Fast: Runs tests significantly faster than human users.

Repeatable: Testers can test how the website or software reacts after
repeated execution of the same operation.

Reusable: Tests can be re-used on different versions of the software.

Reliable: Tests perform precisely the same operation each time they are
run thereby eliminating human error.

Comprehensive: Testers can build test suites of tests that covers every
feature in software application.

Programmable: Testers can program sophisticated tests that bring hidden


information.
Conclusion

• Test automation is much more than computers launching test programs.


• An automation architecture includes many factors that need to be
understood and addressed before automating testing.
• It begins with understanding test requirements, the SUT, and the test
environment.
• Using modeling we can understand and analyze the testing and automation
problems.
• This information can then be applied to describe a test automation
environment using structural diagrams and event sequences.
Q&A
Open source functional testing tools
 1) Open Source Tools
 a) Test Management tools
 TET (Test Environment Toolkit)
◦ The goal behind creating the Test Environment Toolkit (TET) was to produce a test driver
that accommodated the then current and anticipated future testing needs of the test
development community. To achieve this goal, input from a wide sample of the
community was used for the specification and development of TET’s functionality and
interfaces.
 TETware
◦ The TETware is the Test Execution Management Systems which allows you to do the test
administration, sequencing of test, reporting of the test result in the standard format (IEEE
Std 1003.3 1991) and this tools is supports both UNIX as well as 32-bit Microsoft Windows
operating systems, so portability of this is with test cases you developed. The TETware
tools allow testers to work on a single, standard, test harness, which helps you to deliver
software projects on time. This is easily available for download on ftp download.
 Test Manager
◦ The Test Manager is an automated software testing tool is used in day to days testing
activities. The Java programming language is used to develop this tool. Such Test
Management tools are used to facilitate regular Software Development activities,
automate & mange the testing activities. Currently Test Manager 2.1.0 is ready for
download. If you want to learn more information of Test Manager, Click here to get a
latest copy for free.
 RTH
◦ RTH is called as “Requirements and Testing Hub”. This is a open source test management
tool where you can use as requirement management tool along with this it also provides
the bug tracking facilities. Fromhere you can download the latest version of RTH.
 b) Functional Testing Tools c) Load Testing Tools
 Selenium Jmeter
 Soapui FunkLoad
 Watir
 HTTP::Recorder
 WatiN
 Canoo WebTest
 Webcorder
 Solex
 Imprimatur
 SAMIE
 Swete
 ITP
 WET
 WebInject
 2) Proprietary/Commercial tools
 a) Test Management tools
 HP Quality Center/ALM
 QA Complete
 T-Plan Professional
 Automated Test Designer (ATD)
 Testuff
 SMARTS
 QAS.TCS (Test Case Studio)
 PractiTest
 Test Manager Adaptors
 SpiraTest
 TestLog
 ApTest Manager
 DevTest
 b) Functional Testing Tools
 QuickTest Pro
 Rational Robot
 Sahi
 SoapTest
 Badboy
 Test Complete
 QA Wizard
 Netvantage Functional Tester
 PesterCat
 AppsWatch
 Squish
 actiWATE
 liSA
 vTest
 Internet Macros
 Ranorex
 c) Load Testing Tools
 HP LoadRunner
 LoadStorm
 NeoLoad
 Loadtracer
 WebLOAD Professional
 Forecast
 ANTS – Advanced .NET Testing System
 vPerformer
 Webserver Stress Tool
 preVue-ASCII
 Load Impact
Open source functional/performance
testing Tools Link
 http://www.whichtestingtool.com/tool-
evaluation.html
 http://www.mobileapptesting.com/fonemonkey-5-
open-source-testing-tool-for-iphone-ipad/2011/04/
 http://www.opensourcetesting.org/functional.php
 http://www.opensourcetesting.org/performance.ph
p
 http://www.opensourcetesting.org/testmgt.php
 http://www.opensourcetesting.org/security.php
Open source web testing Tools Link
• http://jmeter.apache.org/
• http://grinder.sourceforge.net/
• http://code.google.com/p/multi-mechanize/
• http://seleniumhq.org/
• https://github.com/jnicklas/capybara
• http://opensta.org/
• http://www.pylot.org/
• http://www.webload.org/
• https://github.com/brynary/webrat
• https://github.com/windmill/windmill/
Windows application testing tools

• http://www.autoitscript.com/site/autoit/
• http://www.autohotkey.com/
• http://sourceforge.net/projects/qaliber/
THANK YOU

You might also like