DEV Community

sankar
sankar

Posted on

TASK - 2

Boundary value analysis, decision table testing, use case testing, LCSAJ testing
Boundary value analysis:

Boundary value analysis is a software testing technique used to identify defects at the edges or boundary of input ranges. The idea behind this technique is that errors often occur at the extremes of input values, where the behavior of the software might differ from the expected behavior. It helps in identifying these vulnerability and improving the robustness of the software

In boundary value analysis, you test the minimum and maximum valid values, as well as values just below and above those boundaries. These are the points where issues are most likely to occur due to the transition from one range to another

Example for boundary value analysis:

Let's consider a simple scenario where you are testing a system that calculates the fare for aa taxi ride based on the distance traveled

Requirement: The taxi fare is calculated a 2 rupee per mile

In case, boundary value analysis would involve testing various scenario around the boundary values:

*Minimum value: Test the system with the minimum allowed distance. This is a boundary where the fare should still be calculated correctly. If the fare calculation fails at this point, it indicates a problem with the minimum boundary condition.

*Just below the boundary: Test the system with a distance value slightly below the minimum. This tests whether the system handles invalid input appropriately. The expectation here is that the system should reject negative distance.

*Maximum value: Test the system with the maximum allowed distance. This is another boundary where the fare calculation should work accurately. A failure here might indicate a problem with handling larger values.

*Just above the boundary: Test the system with a distance value slightly above the maximum limit correctly

By performing these tests, you are ensuring that the software handles both valid and invalid inputs at the input range effectively. This can help identify potential issues and make the software more robust.

Decision table testing:

Decision table testing is a technique used to test behavior of a system based on different combinations of input and conditions. It's particularly useful when a system's behavior depends on multiple conditions and their combinations. Decision tables provide a structured way to define these condition and their corresponding actions or outcomes.

Example:

Let's consider a scenario where you are testing a login system that grants access to users based on their user type and the time of day

Conditions

*User type: Regular user(r), admin(a)
*Time of day: Daytime(d), nighttime(n)

Actions:

*Grant access(g)
*deny access(d)

Condition User type time of the day action
case 1 r d g

case 2 r n g
case 3 a d g
case 4 a n d

In the decision table, each row represents a specific combination of condition and the corresponding action that be take. Let's see an example

Case 1: If the user is a regular user and it's daytime, they should be granted access.
Case 2: If the user is a regular user and it's nighttime, they should still be granted access.
Case 3: If the user is an admin and it's daytime, they should be granted access.
Case 4: If the user is an admin and it's nighttime, they should be denied access.

By testing scenarios based on the different cases in the decision table, you can ensure that the system behaves correctly for various combinations of conditions. This approach helps in covering multiple scenarios efficiently and ensures that the system's logic is considered and accurate

Use case testing:

Use case testing is a software testing technique that focuses on validating the interactions between users and a system by testing specific use cases or scenarios. Use cases represent real life interactions with the software and describe the steps users take to accomplish certain tasks

Example:
Let us consider an example of a simple online ordering system for a pizza restaurant, one of the key cases is 'place order'. The use case involves a user selecting pizzas, customizing them, adding them to the cart, and finally placing the order.

Use case: Place order

Scenario:

User browses the menu and selects two pizzas
User customizes the order by selecting toppings and specifying crust preferences.
User adds both pizzas to the cart.
User reviews the cart to ensure the correct items and qualities.
User proceeds to checkout and provides delivery details
User confirms the order
Some of test cases for use case testing:

Test case 1: successful order placement
Test case 2: empty cart check
Test case 3: customization and cart update
Test case 4: Invalid toppings
Test case 5: Delivery address validation
Test case 6: Order confirmation
By testing these different test cases that correspond to the specific use case, you can ensure that the 'place order' functionality of the online ordering system works correctly, provides a smooth user experience, and handles various scenarios effectively. Use can testing helps identify any issues related to user interactions and verifies that the system behaves as expected in real life scenarios

LCSAJ Testing

LCSAJ stands for Linear Code Sequence And Jump. The LCSAJ testing is a white-box testing testing that focuses on testing the linear code sequence and jumps within a program. It aims to ensure that every possible linear code sequence and jump is executed at least once during testing. LCSAJ testing helps in identifying potential issues related to program control flow, branching, and loop execution.

Example:

Consider a simple program. Let's calculate the factorial of a number using recursion:

Def factorial(n):
If n==0:
return 1
else:
return n*factorial(n-1)

In this example, there are several linear code sequence and jumps:

The sequence of statement in the 'factorial' function before the 'if' condition.
The jump from the 'if' condition to the 'return 1' statement.
The sequence of statements within the 'else' block.
The recursive jump to the 'factorial(n-1)' call.
Some of the LCSAJ test cases:

To perform LCSAJ testing on testing on this code, you would need to create test cases that cover all the identified linear code sequence and jumps

Test case 1: n= 0
*Test input: n=0
*Expected result: The function should return 1 without enterning the 'else' block.

Test case 2: n>0
*Test input: n=5
*Expected result: The function should return 1 without entering the 'else' block.

Test case 3: Negative n
*Test input: n= -3

Expected result: The function should handle negative inputs gracefully and return and appropriate result
By testing these specific test cases, you cover the different linear code sequence and jumps within the program. This approach helps in ensuring that all parts of the code are executed and the program's control flow behaves as expected. It's important to identify these sequences and jumps and create test cases that exercise them to achieve comprehensive coverage and identify potential issues in the control flow logic of the code.

Top comments (0)