Testing Techniques with Proper Examples: 1.Boundary value Analysis 2.Decision Table Testing 3.Use Case Testing 4.LCSAJ Testing

Jayachandran V - Mar 22 - - Dev Community
Software Testing has some techniques that can help you to design better test cases. Since exhaustive testing is not possible; Manual Testing Techniques help reduce the number of test cases to be executed while increasing test coverage. They help to identify the test conditions of software application otherwise difficult to recognize.
Enter fullscreen mode Exit fullscreen mode

Software Testing is one of the important aspects of the development of software. Without proper testing, the software developed can be a big failure. Various Software Testing Techniques are available to carry out testing in a systematic way.

Boundary Value Analysis

Boundary value analysis is the process of testing between the extreme ends or boundaries between partitions of the input value.
Boundary value analysis is based on testing at the boundaries between the partitions. It includes maximum, minimum, inside or outside boundaries, typical values and error values.

It is generally seen that a large number of errors occur at the boundaries of the defined input values rather than the center. It is also known as BVA and gives a selection of test cases which exercise bounding values.

This technique focuses on boundaries as a greater number of errors occur at the boundaries of the input domain. For example, the programmer chooses < rather than =< which would lead to defects.

This black box testing technique complements equivalence partitioning. This software testing technique base on the principle that, if a system works well for these particular values then it will work perfectly well for all values which comes between the two boundary values.

Guidelines for Boundary Value analysis

If an input condition is restricted between values A and B, then the test cases should be designed with values A and B as well as values which are above and below A and B.

If an input condition is a large number of values, the test case should be developed which need to exercise the minimum and maximum numbers. Here, values above and below the minimum and maximum values are also tested. Apply guidelines 1 & 2 to get output conditions. It gives an output which reflects the minimum and the maximum values expected. It also tests the below or above values.

Input Values to be tested
Range (Between A & B) A-1, A, A+1,B,B+1,B-1

Number of Values Minimum Number, Minimum
number-1, Maximum number,
Maximum number+1

For Example:

Check the salary of a employee whose salary is maximum 15000 and minimum 10000

Boundary value specification will be:
{9999,10000,15000,15001}

Test Case

Test data Expected Result

9999 False
10000 True
15000 True
15001 False

Decision Table Testing

Decision table testing is also called as Cause-effect graphing. It uses different input conditions (cause) and their system results (output/effect) in a graph which is further converted into a tabular form. This technique provides a comprehensive representation of conditions and their actions therefore of cause and their effects.

Steps:

  1. Causes (input conditions) & effects (actions) are listed for a module and a cause-effect graph is developed.
  2. The graph is converted to a decision table.
  3. The decision table is then converted to test cases.

Example:

If X stays at Y place. X has to pay rent to stay in Y house. If X does not have money to pay, then will have to leave the house.

Causes:
C1 – X stays at Y place.
C2 – X has money to pay rent.

Effects:
E1 – X can stay at Y place.
E2 – X has to leave the house.

Use Case Testing

Use Case represents the different ways in which the system can be used by the users. The use case divides the system behavior into scenarios, such that each scenario performs some useful action from the users point of view.

Each scenario may involve a single message or multiple message exchanges between the user and the system to complete itself.

Representation of Use cases:

A use case is represented with actors and systems. The actor represents the user. The system represents the use case.

Use Case Testing:

Use Case testing is a technique wherein the use cases identify all the test cases that cover the complete system.

Example:

When a new user tries to create an account on a travels website.

Main Success Scenario Step Description
A: Actor 1 A:Enters mobile no
S: System
2 S: Verifies mobile number &
asks to put OTP

3 A: Receives OTP and fill it
on the site.
4 S: Verifies OTP and asks to
put password

5 A: Puts the password
6 S: Verifies the password

7 A:clicks on sign up to
create a account

Extensions 2a Incorrect mobile number
A:clicks on sign up to
2b create a account
S: Displays message That
user already exists
4a Incorrect OTP
S: Asks to enter valid OTP
4b correct OTP
S:accepts & asks to provide
password
6a Password does not match the
criteria
S: Displays message
“Incorrect Password”

In first a positive scenario that carries end-to-end testing is tested. Therefore, complete scenario of creating an account is tested. Afterward, negative testing starts therefore if the mobile number is incorrect, the user will get a message for the same.

Once the user provides a correct mobile number, the system will send OTP to the users mobile number and the user will have to provide the same on the OTP field of the signup screen.

In case of incorrect OTP, the system asks to provide the correct OTP. Once correct OTP is provided, the system asks to fill the password, and the password should match the criteria defined and else it asks to fill the password again. Once the correct password is provided the system creates the users account by clicking sign up.

LCSAJ Testing

What is LCSAJ Testing?

The LCSAJ testing stands for "Linear Code Sequence and Jump".
this method requires access to the source code, and presents results with reference to that source code. This method of testing is an White box testing technique to identify the code coverage, Which begins at the start of the program or branch and ends at the end of the program or the branch.

LCSAJ is a program unit composed of textual code sequence that terminates in a jump to the beginning of another code sequence and jump.

LCSAJ characteristics:

100% LCSAJ means 100% statement Coverage
100% LCSAJ means 100% Branch Coverage
100% procedure or function call coverage
100% multiple condition coverage

Execution of sequential programs that contain conditions proceeds in pairs consisting of a sequence of statements executed one after the other and its termination by a jump to the next such pair.

An LCSAJ is represented as a triple X,Y,Z where X and Y are respective to the locations of the first and the last statements and Z is the location to which the statement at Y jumps. This generally we follow not with this movement indirectly through modified condition testing will add it certain specific industries or applications that report to have this, so this is a software
analysis method basically used to identify structural units in code under test. Its primary use is with dynamic software analysis top help answer the question how much testing is enough?

That means basically it will have an analysis of how much is tested?

In terms of dynamic software behavior or analysis, dynamic software analysis is used to measure the quality and efficacy of software test data, where the quantification is performed in terms of structural units of the code under test that is based on the structural unit and its behavior or the functionality the dynamic software analysis is used so it used to measure the quality
identification of the software test data. When used to quantify the structural units exercised the given set of test data, dynamic analysis is also referred to as coverage analysis. So when we are done with the dynamic analysis we will also come up with the coverage analysis, so that is how this is done basically to drive how much of the testing based on the test data is needed is what is been derived for the linear code sequence and jump testing.

Is basically an software code path fragment consisting of a sequence of code that means a linear code sequence followed by a control code jump in consist of the free items basically start of the linear sequence of executable segments at end of the sequence and target line in which the control flow is transferred at this end of this, suppose function 1, 2 I am just mentioning in
numbers like which one in number of function laws are executed by the fragments are there in the function. so what do we do with the LCSAJ basically how much are you test for this is what is going to
tell that is its basically code path, code path fragment I may test1, I may test 2, I may test some by randomly N 20 may be N. so that means consisting of sequence of code it is called linear code
sequence. And jumping to the different linear it is called jump control flow jump basically so what do we do.

Do you have a code path fragment?

Consistent of sequence of code linear code sequence followed by a control flow jump so we start with this and then we will have a control flow jump and basically the jump could be achieved with a following three types that is start, then end you know that we need to have end for the function in law and the target line. That means with the help of this target line how we have jumped to the end basically. That mean the target line each control flow is transferred at the end of the sequence, so with the help of this will basically used where we have numerous functionality having expected output and similar sort of inputs you have some of the functions so that is how you use the LCSAJ method. So in the continuation of this basically LCSAJ method will have the TER which is called the test effective ratio. So what is test effective ratio? It is number of statement executed by number of effective statements, number of control flow branches executed by total number of control flow branches they have number of LCSAJ executed by total number of LCSAJ.

Altogether you can have a TER that is effectiveness ratio how much of the code we have sequenced and jump in terms of
testing. So accordingly we will have this sort of testing and coverage also will take care of this, coverage or metrics are used to botch and hours testing has been achieved the most terrific metrics is proportion of statements test effective ratio1 TER1, is called as number of statements executed by total number of executive statements. Higher level coverage metrics can also be generated in particular thing.

The next level of TER control flow branches is in to whatever admission are branches that we have seen before you are right total number of control flow branches how much is there? So whether we are able to test it or we are able to free value the metrics, so this TER will give basically in the sequences whatever we have done, so TER 3 number of number of executive statements divided by total number of LCSAJ. So this metrics that is for the hierarchy whereby when the TER1 100% has been achieved it follow that TER2 should be 100% then TER 1 should be 100%, so I used to have TER1 as to be 100% so that the number of LCSAJ are executed by the total number of series become 100%. So this is been traditionally very old method so both the TER1 & 2 get results for 70 and the third results for the later 70. And the requirements actually for the TER1 100% was the level and used to be called TER and then they define TER1, TER2, TER3 like this levels of testing based mention based on the safety and embedded software they will have a definitions of the embedded software levels.

Later they have a MCDC modified condition decision coverage that we have studied in the numerous slides. So it was added 1992 higher levels of TER 3 100 has been mandatory for many other projects including aero space telephone and banking. So where there is a mandated TER3 should be 100% liners force sequence and jump is 100% mandatory when practical problem of using TER3 is that many LCSAJ can never be executed due to the conferencing condition they may contain.

We know that we have different jumps sequence that is start of the linear sequence of executive statement. And the target line to which control flow is transferred at the end of the executive statement, so it is basically it is the units in the map that executed all of them to subjective but it is mandatory.

It has oversight of that integer it counts 0 in what it does is while the count is less than iterations that means 750 times this block will be executed this value will be execute of some number and modules consume columns and total array will be assigned with 1 implemented if the total of the particular value is greater than maximum code it will assign the ledger count, the count will get
implemented so that up to 750 times it will be executed. Hence it will not be assigned. So with help of this example so there is a LCSAJ triples it is called as I said start fine finish line jump line, so there are eight LCSAJ numbers have been identified and start line is 10 or the first three or then we have the start line of 17 for the next three and then 7th one is 25 and the 8th one is 28. So based on this follows which there are LCSAJ numbers for that and total number of LCSAJ are 28.

The first one in LCSAJ then start line 10 is used and finish line is 17that means 10 is wiped after these values and 17 is the 28 positive last power backing. So within this what are going to
happen like assumed as one LCSAJ similarly we have 10 then 21 and finish line is 17 jump line is 28 that means it is 17 so this is a 10 set and we have 17 11, 12, 13, 14, 15, 16, 17 and the jumped line 28 So likewise we are going to have start line 17 and finish line 21 they draw a table so that is about LCSAJ understanding where the use the TER test effective ratio with help of the LCSAJ is the sequences where the sequence of executable when it starts and it ends and the target line with the control flow is getting targeted, so that is how they are going to test it. And you can see some of the table tasks about started line are the same.
Which is same here 28- 28 is same that is the last one written 0 is the same and the jump line that last program, similarly we have 17-17 the last line is 28. So that is how the key aspects will be
tested in the LCSAJ type of white box testing.

Examples:

int f1(int a, int b)
{
while(a!=b)
{
if(a>b)
a=2*(a-b);
else
b=3*(b-a);
}
return a;
}

LCSAJ Sequence Start sequence End Jump
1 1 3 10
2 9 11 Exit
3 1 5 7
4 7 9 3
5 3 3 9
6 1 6 3
7 1 6 3
8 3 5 7

. . . . . . .