Unit4 Testing Class
Unit4 Testing Class
CCS356 V.S 1
CCS356 V.S 2
What is Software Testing ?
• Testing is the process of executing a program
with the intent of finding faults.”
CCS356 V.S 3
Terms ( similar but means different)
• bugs are faults in system or application which impact on software
functionality and performance.
• When we make an error during coding, we call this a ‘bug’. Hence, error /
mistake / defect in coding is called a bug.
• There are different types of bugs, some of them are given below.
– Functional Errors
– Compilation Errors
– Missing commands
– Run time Errors
– Logical errors
– Inappropriate error handling
Alpha
TestingConducted at the developer’s
siteDone by internal users or testers
Beta Testing
Conducted at the customer’s environme
Done by real users
Testing Technique
├── Static Testing
└── Dynamic Testing
CCS356 V.S 5
Internal and External Views of Testing
• Any engineered product (and most other things) can be tested
in one of two ways:
• (BLACK-BOX testing) Testing the
functionalities of the software product
without knowing inner implementation
details
• (WHITE-BOX testing) Knowing the internal
workings of a product, tests can be conducted
on the internal operations are performed
according to specifications and all internal
components have been adequately exercised
CCS356 V.S 6
CCS356 V.S 7
CCS356 V.S 8
Test Case
Test Case ID Test Scenario Preconditions Test Steps Test Data Expected Result
Course registered
1. Login 2. Go to Course
Register for an Student logged in; Course ID: successfully and
CRS_TC_01 Registration 3. Select
available course seats available CS301 confirmation message
course 4. Click Register
displayed
System displays message:
Register for a course Student logged in; 1. Login 2. Select full Course ID:
CRS_TC_02 “Course is full. Registration
that is full course capacity full course 3. Click Register CS302
failed.”
Student already 1. Login 2. Select same System displays message:
Duplicate course Course ID:
CRS_TC_03 registered for the course again 3. Click “You are already registered
registration CS301
course Register for this course.”
Student has not 1. Login 2. Select System displays message:
Register without Course ID:
CRS_TC_04 completed prerequisite advanced course 3. Click “Prerequisite course not
prerequisite CS401
course Register completed.”
1. Login 2. Go to Course removed from
Drop a registered Student already Registered Courses 3. Course ID: schedule and message
CRS_TC_05
course registered for course Select course 4. Click CS301 “Course dropped
Drop successfully.”
View registered 1. Login 2. Navigate to System displays list of
CRS_TC_06 Student logged in Student ID
courses Registered Courses page registered courses
System displays error
Register with invalid 1. Login 2. Enter invalid Course ID:
CRS_TC_07 Student logged in message “Invalid course
course ID course ID 3. Click Register XYZ999
ID.”
User is logged out and
CRS_TC_08 Logout from system Student logged in 1. Click Logout button —
redirected to login page
CCS356 V.S 9
CCS356 V.S 10
white box testing
• which also known as glass box testing, structural
testing, clear box testing, open box testing and
transparent box testing
• It is based on inner workings of an application
• revolves around internal structure testing.
• programming skills are required to design test cases.
• The primary goal is to focus on the flow of inputs
and outputs through the software and strengthening
the security of the software.
CCS356 V.S 11
Generic steps of white box testing
1. Design all test scenarios, test cases and prioritize them
according to high priority number.
2. the study of code at runtime to examine the resource
utilization, not accessed areas of the code, time taken by
various methods and operations and so on.
3. testing of internal subroutines takes place. Internal
subroutines such as nonpublic methods, interfaces are able
to handle all types of data appropriately or not.
4. focuses on testing of control statements like loops and
conditional statements to check the efficiency and accuracy
for different data inputs.
5. white box testing includes security testing to check all
possible security loopholes by looking at how the code
handles security
CCS356 V.S 12
Advantages of White box testing
✓White box testing optimizes code so hidden
errors can be identified.
✓Test cases of white box testing can be easily
automated.
✓This testing is more thorough than other
testing approaches as it covers all code paths.
✓It can be started in the SDLC phase even
without GUI.
CCS356 V.S 13
Disadvantages of White box testing
❖White box testing is too much time consuming when it
comes to large-scale programming applications.
❖White box testing is much expensive and complex.
❖It can lead to production error because it is not detailed
by the developers.
❖White box testing needs professional programmers who
have a detailed knowledge and understanding of
programming language and implementation.
CCS356 V.S 14
Techniques Used in White Box Testing
Data Flow Data flow testing is a group of testing strategies that examines the
Testing control flow of programs in order to explore the sequence of
variables according to the sequence of events.
Control Flow Control flow testing determines the execution order of statements or
Testing instructions of the program through a control structure. The control
structure of a program is used to develop a test case for the program.
In this technique, a particular part of a large program is selected by
the tester to set the testing path. Test cases represented by the
control graph of the program.
Branch Testing Branch coverage technique is used to cover all branches of the
control flow graph. It covers all the possible outcomes (true and
false) of each condition of decision point at least once.
Statement Statement coverage technique is used to design white box test cases.
Testing This technique involves execution of all statements of the source
code at least once. It is used to calculate the total number of
executed statements in the source code, out of total statements
present in the source code.
Decision This technique reports true and false outcomes of Boolean
Testing expressions. Whenever there is a possibility of two or more
outcomes from the statements like do while statement, if statement
and case statement (Control flow statements), it is considered as
decision point because there are two outcomes either true or false.
CCS356 V.S 15
Statement Coverage Testing
• This technique involves execution of all statements of the source code at least
once.
• It is used to calculate the total number of executed statements in the source
code out of total statements present in the source code.
CCS356 V.S 16
Statement coverage = 5/7*100 =71%
Statement Coverage Testing
Scenario 2: If A = -2, B = -7
CCS356 V.S 17
Branch coverage technique
• used to cover all branches of the control flow
graph.
• It covers all the possible outcomes (true and
false) of each condition of decision point at
least once.
CCS356 V.S 18
Read X
Read Y
IF X+Y > 100 THEN
Print "Large"
ENDIF
If X + Y<100 THEN
Print "Small"
ENDIF
Yes 1, 2, 4, 5, 6, 8 A1-B2-C4-D6-E8 2
No 3,7 A1-B3-5-D7
CCS356 V.S 19
Decision Coverage Testing
• This technique reports true and false outcomes of Boolean expressions.
• Whenever there is a possibility of two or more outcomes from the
statements like do while statement, if statement and case
statement (Control flow statements),
(a=7)
Test (int a)
{
If(a>4)
a=a*3
Print (a)
}
CCS356 V.S 20
Decision Coverage Testing
1 3 3 50%
2 7 21 50%
CCS356 V.S 21
Path coverage testing ( basis path )
CCS356 V.S 22
Path coverage testing ( basis path )
• M = E – N + 2P
• where,
E = the number of edges in the control flow graph
N = the number of nodes in the control flow graph
P = the number of connected components
CCS356 V.S 23
cyclomatic complexity
• Cyclomatic Complexity = Total number of
closed regions in the control flow graph + 1
• Cyclomatic Complexity = P + 1
– Here, P = Total number of predicate nodes
contained in the control flow graph
CCS356 V.S 24
A = 10
IF B > C THEN
A=B
ELSE
A=C
ENDIF
Print A
Print B
Print C
CCS356 V.S 25
IF A = 354
THEN IF B > C
THEN A = B
ELSE A = C
END IF
END IF
PRINT A
Total number of closed regions in the control flow graph + 1
=2+1=3
Cyclomatic Complexity
=E–N+2 =8–7+2 =3
Cyclomatic Complexity
=P+1 =2+1 =3
CCS356 V.S 26
Cyclomatic Complexity Meaning
•Structured and Well Written Code
1 – 10 •High Testability
•Less Cost and Effort
•Complex Code
10 – 20 •Medium Testability
•Medium Cost and Effort
•Very Complex Code
20 – 40 •Low Testability
•High Cost and Effort
•Highly Complex Code
> 40 •Not at all Testable
•Very High Cost and Effort
CCS356 V.S 27
Cyclomatic Complexity = E – N + 2
= 16 – 14 + 2 = 4
CCS356 V.S 28
V(G) = e – n + 2P = 16 – 15 + 2 = 3
V(G) = no. of regions = 3
CCS356 V.S 29
CCS356 V.S 30
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.
• changed version of the program is known as a mutant of the
original program
CCS356 V.S 31
Mutation Testing….
Original Program Mutant Program
If (x>y)
If(x<y)
Print "Hello"
Print "Hello"
Else
Else
Print "Hi" Print "Hi"
Statement Mutation - developer cut and pastes a part of a code of which the outcome
may be a removal of some lines
Value Mutation- values of primary parameters are modified
Decision Mutation- control statements are to be changed
CCS356 V.S 32
Steps in mutation testing
• Step 1: Faults are introduced into the source code of the program
by creating many versions called mutants. Each mutant should
contain a single fault, and the goal is to cause the mutant version to
fail which demonstrates the effectiveness of the test cases.
• Step 2: Test cases are applied to the original program and also to
the mutant program. A Test Case should be adequate, and it is
tweaked to detect faults in a program.
• Step 3: Compare the results of an original and mutant program.
• Step 4: If the original program and mutant programs generate the
different output, then that the mutant is killed by the test case.
Hence the test case is good enough to detect the change between
the original and the mutant program.
• Step 5: If the original program and mutant program generate the
same output, Mutant is kept alive. In such cases, more effective test
cases need to be created that kill all mutants.
CCS356 V.S 33
UNIT testing
CCS356 V.S 34
Introduction
► A module encapsulates code and data to implement a
particular functionality.
MODULE FUNCTIONALITY
CCS356 V.S 35
Module example
MATH COUNTER
MATH_Addition(int a,
int b) COUNTER_START()
MATH_Subtraction(int a,
int b)
COUNTER_STOP()
MATH_Multiplication(int a,
int b)
MATH_Division(int a, COUNTER_RESET()
int b)
CCS356 V.S 36
Software systemexample
ERP
Mobile
app
system
M1 M2 M3
M M
1 2
M1. M2. M3.
M1. M1. M1. M2.
1 2 3 1 1 1 1
M1.
M - Module 2
CCS356 V.S 37
Whatis unit
testing?
• lowest level of testing
• tested in isolation
• most through look at detail
• tests are written and run
by software developers
CCS356 V.S 38
Whatis unitSoftware development
testing? process V-Model
When is unit
testing
performed?
CCS356 V.S 39
Whatis unit testing?
When is unit testing performed?
CCS356 V.S 40
Whatis unit testing?
CCS356 V.S 41
Benefits
• Unit testing allows the programmer to
refactor code at a later date, and make
sure the module still works correctly.
CCS356 V.S 42
Data flow Testing
Control Flow Testing
Branch Coverage Testing
Statement Coverage
Testing
Decision Coverage Testing
Stub Driver
Stub is considered as subprogram. It is a simple main program.
Stub does not accept test case data. Driver accepts test case data.
CCS356 V.S 43
Testing Case Design Strategies
▪ Software testing is the process to uncover errors in requirement, design and coding.
▪ It is used to identify the correctness, completeness, security and quality of software
products against a specification.
▪ Two basic approaches of software testing are:
1. Black Box Testing
1. Equivalence Partitioning
2. Boundary Value analysis
3. Cause effect graphing
4. Error guessing
2. White Box Testing
1. Statement Coverage
2. Branch Coverage
3. Conditional Coverage
4. Path Testing
CCS356 V.S 44
Software Testing Taxonomy
Alpha
• Testing Conducted at the developer’s site
• Done by internal users or testers
Beta Testing
• Conducted at the customer’s environme
• Done by real users
Testing Technique
├── Static Testing
└── Dynamic Testing
CCS356 V.S 45
Testing Case Design Strategies
Black Box Testing
◼ Method that examines the functionality of an application, without
looking at its structure.
◼ The tester does not ever examine the programming code and does
not need any further knowledge of the program other than
requirement specifications (SRS).
◼ You can begin planning for black box testing soon after the
requirements and the functional specifications are available.
CCS356 V.S 46
Black Box Testing
Advantages
◼ The designer and the tester are independent of each other.
◼ The testing is done from the point of view of the user.
◼ Test cases can be designed when requirements are clear.
CCS356 V.S 47
Black Box Testing
Disadvantages
◼ Test cases are difficult to design.
◼ Testing every output against every input will take a long time and
many program structures can go unchecked.
◼ Inefficient testing because tester only has limited knowledge about
an application.
CCS356 V.S 48
Equivalence Class Partitioning
• Equivalent Class Partitioning is a black box technique (code is not visible to
tester)
• can be applied to all levels of testing like unit, integration, system, etc.
• In this technique, you divide the set of test condition into a partition that
can be considered the same.
• It divides the input data of software into different equivalence data
classes.
You can apply this technique, where there is a range in the input field.
CCS356 V.S 49
CCS356 V.S 50
Consider a program for the determination of the largest
amongst three numbers.
Its input is a triple of positive integers (say x,y and z) and
values are from interval [1, 300].
CCS356 V.S 51
Output domain equivalence classes are:
O1= {<x, y, z > : Largest amongst three numbers x, y, z }
O2= {<x, y, z > : Input values(s) is /are out of range with sides x, y, z }
CCS356 V.S 52
Boundary Value Analysis
CCS356 V.S 53
boundary value testing is to select input variable values at their
• Minimum
• Just above the minimum
• A nominal value
• Just below the maximum
• Maximum
CCS356 V.S 54
Boundary Value Analysis
CCS356 V.S 55
Boundary Value Analysis
Input: number of valid values
◼ Test Cases (maximum and minimum number of values)
◼ One beneath and beyond these values
Input (file can contain 1-255 records)
◼ Test Cases
◼ 0, 1, 255, and 256 records.
Types of Boundary conditions
◼ numeric character position quantity speed location size
Also, extremes
◼ first/last min/max start/finish over/under empty/full
Shortest/longest slowest/fastest largest/smallest …
CCS356 V.S 56
Boundary Value Analysis
Use these guidelines for each output condition
Output: Monthly Deduction
◼ Minimum = 0.0, Maximum = 3500.50
Test Cases to cause
◼ 0.0 deduction and 3500.50 deduction
If possible to design test cases to have negative
deduction and deduction larger than 3500.50.
If input or output of a program is an ordered set
(a sequential file, linear list, table) focus
attention on the first and last elements of the set.
CCS356 V.S 57
Example
CCS356 V.S 58
Example
Inputs: Accommodation Expense
Boundaries of the Input Values
Better to show Boundaries Graphically
◼ Boundary: 0 < Expense ≤
3,000 0 3,000
| |
-1|+1 2,900|3,001
CCS356 V.S 59
Equivalence Class Partitioning
CCS356 V.S 60
Test Case Generation (Using Black Box) and Test
Data Generation (Equivalence Class Partitioning)
CCS356 V.S 61
Test Case Generation (Using Black Box) and Test
Data Generation (Equivalence Class Partitioning)
Test Case 1 2 3
CCS356 V.S 62
Worst-Case Testing
CCS356 V.S 63
Boundary Analysis
CCS356 V.S 64
CCS356 V.S 65
Boundary Analysis
We analyze the range of dates by partitioning
the month field for the date into different sets:
◼ {February}
◼ {April, June, September, November}
◼ {Jan, March, May, July, August, October, December}
For testing, you want to pick one of each. There
might or might not be a “boundary” on months.
The boundaries on the days, are sometimes 1-28,
sometimes 1-29, etc
CCS356 V.S 66
Error Guessing
CCS356 V.S 67
Test Case Generation (Using Black Box) and Test
Data Generation (Equivalence Class Partitioning)
❑ Consider a function, Grade(), with the following
specification:
❑ The function is passed an coursework out of 100 out of
which it generates a grade for the course in the range
‘A’ to ‘D’.
❑ The grade is calculated from the overall mark, which is
calculated as the sum of exam and c/w marks, as
follows:
greater than or equal to 70 ‘A’
greater than or equal to 50, but less than 70 ‘B’
greater than or equal to 30, but less than 50 ‘C’
less than 30 ‘D’
Where a mark is outside its expected range then a fault
message (‘FM’) is generated.
All inputs are passed as parameters.
CCS356 V.S 68
Test Case Generation (Using Black Box) and Test
Data Generation (Equivalence Class Partitioning)
CCS356 V.S 69
Test Case Generation (Using Black Box) and Test
Data Generation (Equivalence Class Partitioning)
Input :: Course mark
Equivalence Class Partitions
◼ Valid
0 ≤ real number ≤ 100
◼ Invalid
alphabetic
Coursework < 0
Coursework > 100
CCS356 V.S 70
Test Case Generation (Using Black Box) and Test
Data Generation (Equivalence Class Partitioning)
Invalid E.C.(s)
Course Mark < 0 ‘FM’
Course Mark > 100 ‘FM’
Valid E.C.(s)
0 ≤ Course Mark < 30 ‘D’
30 ≤ Course Mark < 50 ‘C’
50 ≤ Course Mark < 70 ‘B’
70 ≤ Course Mark ≤ 100 ‘A’
CCS356 V.S 71
Test Case Generation (Using Black Box) and Test
Data Generation (Equivalence Class Partitioning)
Valid Partitions
TEST CASES 1 2 3
CCS356 V.S 72
Test Case Generation (Using Black Box) and Test
Data Generation (Equivalence Class Partitioning)
Invalid Partitions
Test cases 4
Expected output FM
CCS356 V.S 73
Test Case Generation (Using Black Box) and Test
Data Generation (Equivalence Class Partitioning)
CCS356 V.S 74
Test Case Generation (Using Black Box) and Test
Data Generation (Equivalence Class Partitioning)
Valid Partitions
Test cases 5 6 7
Course Marks -20 17 45
Partition tested 0<C 0<=C<=30 30<=C<50
CCS356 V.S 75
Test Case Generation (Using Black Box) and Test
Data Generation (Equivalence Class Partitioning)
Valid Partitions
Test Case 8 9 10
Expected output B A FM
CCS356 V.S 76
Minimal Test Cases
CCS356 V.S 77
Test Cases for Multiple E.P.(s)
CCS356 V.S 78
Test Cases for Multiple E.P.(s)
CCS356 V.S 79
CCS356 V.S 80
CCS356 V.S 81
Decision table technique
CCS356 V.S 82
If both email and password are correctly matched, the user will be directed
to the email account's homepage; otherwise, it will come back to the login
page with an error message specified with "Incorrect Email" or "Incorrect
Password."
CCS356 V.S 83
CCS356 V.S 84
CCS356 V.S 85
CCS356 V.S 86
Cause –effect graphic
❖ Cause Effect Graph is a black box
testing technique that graphically
illustrates the relationship between a
given outcome and all the factors that
influence the outcome.
CCS356 87
V.S
Cause – effect graphic
❖Step 1: Identify the causes and the
effects
❖Step 2: Establish the graph of relations
between causes and effects
❖Step 3: Complete the graph by adding
constraints between causes and
effects
❖Step 4: Convert the graph to a decision
table
❖ Step 5: Generate a test cases
CCS356 88
V.S
CCS356 89
V.S
Example : The “Print message” is software that reads two characters
and, depending on their values, messages is printed.
• The first character must be an “A” or a “B”.
• The second character must be a digit.
• If the first character is an “A” or “B” and the second character is a digit,
then the file must be updated.
• If the first character is incorrect (not an “A” or “B”), the message X must
be printed.
• If the second character is incorrect (not a digit), the message Y must be
printed
CCS356 90
V.S
The Causes of this situation The Effects (results) for this situation are:
are: E1 – Update the file
C1 – First character is A E2 – Print message “X”
C2 – First character is B E3 – Print message “Y”
C3 – the Second character
is a digit
CCS356 91
V.S
E2 states print message “X”. Message X will be printed when the First character
is neither A nor B.
This means Effect E2 will hold true when either C1 OR C2 is invalid. So the graph
for Effect E2 is shown as (In blue line)
CCS356 92
V.S
For Effect E3.
E3 states print message “Y”. Message Y will be printed when the Second
character is incorrect.
This means Effect E3 will hold true when C3 is invalid. So the graph for Effect
E3 is shown as (In Green line)
CCS356 93
V.S
Writing Decision Table Based On Cause And Effect graph
First, write down the Causes and Effects in a single column shown below
traverse from Effect to Cause
Now for E1 to be “1” (true), we have the below two conditions –
C1 AND C3 will be true
C2 AND C3 will be true
CCS356 94
V.S
adding 0 in the blank column
CCS356 95
V.S
Writing Test Cases From The Decision Table
Below is a sample test case for Test Case 1 (TC1) and Test Case 2 (TC2).
CCS356 96
V.S
Example
CCS356 97
V.S
Step 2
CCS356 98
V.S
Example – Step 3
CCS356 99
V.S
Example – Step
3
CCS356 10
V.S 0
Example – Step
4
CCS356 10
V.S 1
Example – Step 5
CCS356 10
V.S 2
State transition
testing
State transition technique is a
dynamic testing technique, which is
used when the system is defined in
terms of a finite number of states and
the transitions between the states is
governed by the rules of the system.
CCS356 10
V.S 3
Shopping
Cart
• Your Shopping Cart is empty -
S1
• Add Item - S2
• Remove Item
• Checkout - S3
• Payment - S4
CCS356 10
V.S 4
State –Transition
diagram
CCS356 10
V.S 5
State -Transition
Tables
CCS356 10
V.S 6
Test
Case
CCS356 10
V.S 7
integration testing
Integrate/combine the unit tested module one by one and test the
behavior as a combined unit.
CCS356 10
V.S 8
CCS356 10
V.S 9
Big Bang Approach:
Here all component are integrated together at once and then tested.
Advantages:
• Convenient for small systems.
Disadvantages:
• Fault Localization is difficult.
• Given the sheer number of interfaces that need to be tested in this
approach, some interfaces link to be tested could be missed easily.
• Since the Integration testing can commence only after "all" the modules
are designed, the testing team will have less time for execution in the testing
phase.
• Since all modules are tested at once, high-risk critical modules are not
isolated and tested on priority. Peripheral modules which deal with user interfaces
are also not isolated and tested on priority.
CCS356 11
V.S 0
Top-down Integration:
• In Top to down approach, testing takes place from top
to down following the control flow of the software system.
• Takes help of stubs for testing.
Breadth-first integration
incorporates all components
directly subordinate at each level,
moving across the structure
horizontally
CCS356 11
V.S 1
The top-down integration process is performed in a series
of five steps:
1. The main control module is used as a test driver and stubs are
substituted for all components directly subordinate to the main
control module.
2. Depending on the integration approach selected (i.e., depth or
breadth first), subordinate stubs are replaced one at a time with
actual components.
3. Tests are conducted as each component is integrated.
4. On completion of each set of tests, another stub is replaced with
the real component.
5. Regression testing (refer previous section of notes) may be
conducted to ensure that new errors have not been introduced.
CCS356 11
V.S 2
A bottom-up integration strategy may be implemented
with the following steps:
1. Low-level components are combined into clusters (sometimes called builds)
that perform a specific software subfunction.
2. A driver (a control program for testing) is written to
coordinate test case input and output.
3. The cluster is tested.
4. Drivers are removed and clusters are combined moving
upward in the program structure.
CCS356 11
V.S 3
Coding Standards and Guidelines
Martin Fowler. Any fool can write code that a computer can
understand. Good programmers write code that humans can
understand.
CCS356 11
V.S 4
•Indentation: Proper and consistent indentation is essential in producing easy to read
and maintainable programs.
Indentation should be used to:
Emphasize the body of a control structure such as a loop or a select statement.
Emphasize the body of a conditional statement
Emphasize a new scope block
•Inline comments: Inline comments analyze the functioning of the subroutine, or key
aspects of the algorithm shall be frequently used.
•Rules for limiting the use of global: These rules file what types of data can be declared
global and what cannot.
•Structured Programming: Structured (or Modular) Programming methods shall be used.
"GOTO" statements shall not be used as they lead to code, which is hard to read and
maintain,.
•Naming conventions for global variables, local variables, and constant identifiers: A
possible naming convention can be that global variable names always begin with a capital
letter, local variable names are made of small letters, and constant names are always
capital letters.
•Error return conventions and exception handling system: Different functions in a
program report the way error conditions are handled should be standard within an
organization. For example, different tasks while encountering an error condition should
CCS356 11
either return
V.S a 0 or 1 consistently. 5
example
int totalMarks; // Good
int tm; // Bad
CCS356 11
V.S 6
• Coding Standards for Components: It is recommended to write components name
by its purpose. This approach improves the readability and maintainability of code.
• Coding Standards for Classes: Usually class name should be noun starting with
uppercase letter. If it contains multiple word than every inner word should start
with uppercase.
• Eg: String, StringBuffer, Dog
• Coding Standards for Interface: Usually interface name should be adjective starting
with uppercase letter. If it contains multiple word than every inner word should
start with uppercase.
• Eg: Runnable, Serializable, Comparable
• Coding Standards for Methods: Usually method name should either be verb or
verb noun combination starting with lower letter. If it contains multiple word than
every inner word should start with uppercase.
• Eg: print(), sleep(), setSalary()
• Coding Standards for Variables: Usually variable name should be noun starting with
lowercase letter. If it contains multiple word than every inner word should start
with uppercase.
• Eg: name, age. mobileNumber
• Coding Standards for Constants: Usually constant name should be noun. It should
contain CCS356
only uppercase If it contains multiple word than words are separated
11 with (
V.S 7
_ ) underscore symbol. Usually we declare constants with public static and final
Code Smells
void processOrder() {
class User {
// validate order
void login() {}
// calculate price
void register() {}
// apply discount
void sendEmail() {}
// save to database
void generateReport() {}
// send email
}
}
CCS356 11
V.S 8
Code refactoring
• Refactoring is the process of making improvements to a
program to slow down degradation through change.
CCS356 11
V.S 9
CCS356 12
V.S 0
CCS356 12
V.S 1
Code walkthrough
public class FactorialExample {
public static void main(String[] args) {
int num = 5;
int result = factorial(num);
[Link]("Factorial of " + num + " is: " + result);
}
CCS356 12
V.S 3
regression testing
Regression testing is a black box testing techniques.
It is used to authenticate a code change in the software does not
impact the existing functionality of the product..
Example:
Assume login button is not working in a login page and a tester reports a bug
stating that the login button is broken. Once the bug fixed by developers, tester
tests it to make sure Login Button is working as per the expected result.
Simultaneously, tester tests other functionality which is related to the login
button.
4. When there is a performance issue fix
Example:
Loading of a home page takes 5 seconds, reducing the load time to 2 seconds.
Re-Test is one of the approaches to do regression testing. In this approach, all the test
case suits should be re-executed.
Regression test Selection: a selected test-case suit will execute rather than an entire
test-case suit. The selected test case suits divided in two cases
Reusable Test cases.
Obsolete Test cases.
Prioritize the test case depending on business impact, critical and frequently
functionality used. Selection of test cases will reduce the regression test suite.
CCS356 12
V.S 6
Types of regression test
CCS356 12
V.S 9
2. Balance Inquiry
•User checks account balance
•Balance updates after transactions
Expected Result: Correct balance should be displayed.
4. Transaction History
•View recent transactions
•Check new UPI transfers appear in history
CCS356 13
Expected
V.S Result: All transactions should be recorded correctly.
0
Validation testing
CCS356 13
V.S 1
Debugging Approaches
Debugging is the process of finding and resolving defects or problems within a computer
program that prevent correct operation of computer software or a system.
Brute Force Method : the program is loaded with print statements to print the
intermediate values
Backtracking: starting from the statement at which an error symptom has been
discovered, the source code is derived backward till the error is
discovered
Cause Elimination Method: In this approach, a listing of causes that may presumably
have contributed to the error symptom is developed and tests are conducted to
eliminate every.
Applications
•Software testing (automatic test generation)
•Program verification
•Security analysis (finding vulnerabilities)
•Debugging
CCS356 13
V.S 7
Need of User Acceptance Testing:
CCS356 13
V.S 8
Types of Acceptance Testing:
• User Acceptance Testing (UAT) (End-User Testing.)
to determine whether the product is working for the user correctly.
Specific requirements often used by the customers are chosen.
• Business Acceptance Testing (BAT):
- whether the product meets the business goals and purposes or not.
• Contract Acceptance Testing (CAT):
- contract which specifies that once the product goes live, within a predetermined period,
the acceptance test must be performed and it should pass all the acceptance use cases.
Here is a contract termed as Service Level Agreement (SLA),
Regulations Acceptance Testing (RAT):
- is used to determine whether the product violates the rules and regulations
that are defined by the government of the country where it is being released.
CCS356 13
V.S 9
Software Maintenance
• Software Maintenance is the process of modifying a software product
after it has been delivered to the customer.
• The main purpose of software maintenance is to modify and update
software application after delivery to correct faults and to improve
performance
• Correct faults.
• Improve the design.
• Implement enhancements.
• Interface with other systems.
• Accommodate programs so that different hardware, software, system features,
and telecommunications facilities can be used.
• Migrate legacy software.
• Retire software.
CCS356 14
V.S 0
Types of Software Maintenance
• Corrective maintenance:
either to rectify some bugs observed while the system is in use, or to enhance the
performance of the system.
• Adaptive maintenance:
This includes modifications and updations when the customers need the product
to run on new platforms, on new operating systems, or when they need the
product to interface with new hardware and software.
• Perfective maintenance:
to support the new features that the users want or to change different types of
functionalities of the system according to the customer demands.
• Preventive maintenance:
modifications and updations to prevent future problems of the software. It goals
to attend problems, which are not significant at this moment but may cause
serious issues in future
CCS356 14
V.S 1
Business process reengineering(BPR)
CCS356 14
V.S 2
The BPR model defines six activities
1. Business definition. Business goals are identified within the context of four key
drivers: cost reduction, time reduction, quality improvement, and
personnel development and empowerment.
2. Process identification. critical Processes are identified -- ranked by importance,
by need for change.
3. Process evaluation. The existing process is thoroughly analyzed and measured.
process tasks are identified; the costs and time consumed by process tasks are
noted; and quality/performance problems are isolated.
4. Process specification and design. use cases are prepared for each process that is
to be redesigned. Within the context of BPR, use cases identify a scenario that
delivers some outcome to a customer
5. Prototyping. A redesigned business process must be prototyped before it is fully
integrated into the business. This activity “tests” the process so that refinements
can be made.
6. Refinement and instantiation. Based on feedback from the prototype, the
business process is refined and then instantiated within a business system.
Company Profile:
➢ ICICI Bank (formerly Industrial Credit and Investment
Corporation of India) is a major banking and financial services
organization in India.
➢ It is the 4th largest bank in India and the largest private sector
bank in India by market capitalization.
➢ The bank also has a network of 1,700+branches and about 4,721
ATMs in India and presence in 19 countries, as well as some 24
million customers.
➢ ICICI Bank is one of the Big Four Banks of India, along with State
Bank of India, Axis Bank and HDFC Bank — its main competitors.