software testing – Programmerbay https://programmerbay.com A Tech Bay for Tech Savvy Mon, 19 Sep 2022 18:06:44 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://programmerbay.com/wp-content/uploads/2019/09/cropped-without-transparent-32x32.jpg software testing – Programmerbay https://programmerbay.com 32 32 Difference between Statement Coverage and Branch Coverage in Tabular form https://programmerbay.com/distinguish-between-statement-coverage-and-branch-coverage/ https://programmerbay.com/distinguish-between-statement-coverage-and-branch-coverage/#respond Wed, 14 Sep 2022 16:20:57 +0000 https://programmerbay.com/?p=5540 In software testing, code coverage is a measure that determines how much code in a program is successfully tested. It provides various methods such as branch coverage, statement coverage,decision coverage, FSM coverage and more. In this article, we’ll be discussing branch coverage and statement coverage.

Branch coverage and Statement Coverage are form of white box testing techniques.

The main difference between them is, the aim of statement coverage is to traverse all statements at least once, whereas the goal of branch coverage it to traverse all the branches at least once.

Difference between Statement Coverage and Branch Coverage in Tabular form

Statement CoverageBranch Coverage
Statement coverage is a technique which aims to cover all the statements at least once by executing the programThe main goal of branch coverage is to cover branches at least once (true and false)
It focuses on covering all statements or lines of a programIt focuses on covering branches, both conditional and unconditional
It is weaker criteria than branch coverage as test cases that cover all statements may not cover all the branchesIt is stronger criteria than branch coverage that cover all branches would also cover all the statements too
Coverage Measurement,
Statement coverage = (Total Statements covered/Total Statements )* 100
Coverage Measurement,
Branch coverage = (Total branch covered/Total Branches )* 100

Statement Coverage

It is also termed as Line coverage.
The goal of this technique is to cover all the statements at least once by executing the program.

It requires test cases that make possible to run all the statement consisting of the program in order to achieve 100% coverage. It only assures that all the statements have executed but not assures whether all the paths have covered or not.

For example:

READ A
IF A == 10
THEN
PRINT I am True
ElSE
PRINT I am False
ENDIF

 

Test case #1 ( A = 5 )

Statement coverage = (Total Statements covered/Total Statements )* 100

=(5/7)*100

statement coverage

In the above code, 71.5% statement coverage is achieved by test case #1.

Test case #2 ( A = 10 )

Statement coverage = (Total Statements covered/Total Statements )* 100

=(5/7)*100

statement coverage

Again, 71.5% statement coverage is covered, and altogether these two test cases executed all the possible paths with 71.5% statement coverage each.

Executing every statement of a program helps in finding faults, unreachable or useless statements.

Branch Coverage

In a flow graph, an arrow represents edges and counting a statement as a node, where two nodes are connected with an edge.

A diamond symbol represents the decision node where more than one edges are present in an outgoing manner which is termed as Branches.

The main aim of branch coverage is to cover all the branches ( two separate paths) at least once (true and false).
Branch Coverage is a structurally based technique that checks both conditional and unconditional branches.

Branch  coverage = (number of executed branches/ total number of branches) * 100

For example:

READ A 
IF A == 10
THEN 
PRINT I am True 
ElSE 
PRINT I am False 
ENDIF

 

branch coverage corrected

Branches:

  • 2,5,6,7
  • 2,3,4,7

To cover all the branches we would require 2 test cases:

Test case #1 ( A = 12 )

Branch coverage = (Total branch covered/Total Branches )* 100

=(1/2)*100

branch coverage 50

In the above code, 50% branch coverage is achieved by test case #1.

Test case #2 ( A = 10 )

Branch coverage = (Total branch covered/Total Branches )* 100

=(1/2)*100

branch coverage 50

Again, 50% branch coverage is achieved by test case #2.

Altogether these two test cases executed all the possible branches with 50% branch coverage each.

 

]]>
https://programmerbay.com/distinguish-between-statement-coverage-and-branch-coverage/feed/ 0
C Program To Check whether Triangle is Equilateral, Isosceles or Scalene https://programmerbay.com/c-program-to-classify-a-triangle/ https://programmerbay.com/c-program-to-classify-a-triangle/#respond Sun, 21 Aug 2022 16:33:46 +0000 https://programmerbay.com/?p=5308 The program determines the type of triangle based on the input provided by a user.

A triangle can be broadly classified according to the length of its sides and the angle between the sides.
Based on the sides, there are three types of triangle
1. Equilateral Triangle
2. Isosceles Triangle
3. Scalene Triangle

Based on the angles, there are also 3 types:
1. Acute triangle
2. Right triangle
3. Obtuse triangle

In this article, we’ll be discussing triangles that are classified based on sides, and implementing the same in the program.

type of triangle

  1. Equilateral Triangle: A triangle in which all sides are of the same length
  2. Isosceles Triangle: A triangle in which exactly two sides are equal
  3. Scalene Triangle: A triangle in which all sides are having different length

Approach to determine the type of a triangle

  1. Read the length of a triangle for the user
  2. If side1, side2 and side3 are equal to each other, then
    • print a message the triangle is an equilateral triangle
  3.  If any two from side1, side2 or side3 are having the same length, then
    • print message the triangle is isosceles triangle
  4.  If all three sides are different in length, then
    • print message the triangle is a scalene triangle

C Program To Check whether Triangle is Equilateral, Isosceles or Scalene

The program also implies Triangle Inequality Theorem to validate whether the given sides can be a triangle or not.

Program:

#include<conio.h>
#include<stdio.h>
#include<math.h>
void
main ()
{
  int a, b, c, flag = -1;
  printf (" Enter the values of a, b and c : = ");
  scanf ("%d %d %d", &a, &b, &c);
  if ((a >= 0 && a <= 10) && (b >= 0 && b <= 10) && (c >= 0 && c <= 10)){
 
 // Triangle Inequality Theorem : every side's length should be shorter than sum of other two side
      if (((a + b) > c) && ((b + c) > a) && ((c + a) > b)){
    flag = 1;
    if ((a == b) && (b == c))
      printf ("\n It is an Equilatral Triangle");
    else if ((a == b) || (b == c) || (c == a))
      printf ("\n It is an isosceles Triangle");
    else
      printf ("\n It is a Scalene Triangle");
      }
    }
    
  if (flag == -1)
    printf ("Given side inputs, can't be a triangle ");
    
  getch ();
}

 

Testing Result of the Program

Not a Triangle

 Enter the values of a, b and c : = 11 5 5
Given side inputs, can't be a triangle 

Equilateral triangle

Enter the values of a, b and c : = 4 4 4

It is an Equilateral Triangle

Isosceles Triangle

Enter the values of a, b and c : = 2 3 2

It is an isosceles Triangle

 

]]>
https://programmerbay.com/c-program-to-classify-a-triangle/feed/ 0
C program to Find Previous Date https://programmerbay.com/c-program-to-find-previous-date/ https://programmerbay.com/c-program-to-find-previous-date/#respond Thu, 21 Jul 2022 16:19:49 +0000 https://programmerbay.com/?p=5309 The program prints previous date of the entered input. It validates leap year, month and date to check whether the given date is valid or not. We have simply used nested if in the logic to achieve the functionality.

C Program to determine the previous date

Program:

#include<conio.h>
#include<stdio.h>

int
main ()
{
  int month, date, year, valid = -1, leap_year = -1, invalid_input = -1;
  printf ("please enter a date = ");
  scanf ("%d", &date);
  printf ("please enter a month = ");
  scanf ("%d", &month);
  printf ("please enter a year = ");
  scanf ("%d", &year);
  if ((date > 0 && date <= 31) && (month >= 1 && month <= 12)
      && (year >= 2000 && year <= 2050))
    {
      invalid_input = 1;
      // finding given input is a leap year or not
      if ((year % 4) == 0)
  {
    leap_year = 1;
    if ((year % 100) == 0)
      {
        if ((year % 400) == 0)
    {
      leap_year = 1;
    }
        else
    {
      leap_year = -1;
    }
      }
  }
      if (month == 2 && leap_year == 1 && date > 29)
  valid = -1;
      else if (month == 2 && leap_year == -1 && date > 28)
  valid = -1;
      else
  valid = 1;
    }

  if ((month == 6 || month == 4 || month == 9 || month == 11) && date > 30)
    valid = -1;

// validating & finding output


  if (valid == 1)
    {
      printf ("Entered date = %d-%d-%d", date, month, year);

      if (date == 1)
  {
    if (month == 1)
      {
        date = 31;
        month = 12;
        year--;
      }
    else if (leap_year = 1 && month == 3)
      {
        date = 29;
        month--;
      }
    else if (leap_year == -1 && month == 3)
      {
        date = 28;
        month--;
      }
    else if (month == 2 || month == 4 || month == 6 || month == 8
       || month == 9 || month == 11)
      {
        date = 31;
        month--;
      }
    else
      {
        date = 30;
        month--;
      }
  }
      else
  {

    date--;
  }
      printf ("\nPrevious date = %d-%d-%d \n", date, month, year);
    }

  if (valid == -1 && invalid_input == 1)
    printf ("\n Not a valid date");

  if (invalid_input == -1)
    printf ("\n Invalid Input");

  return 0;
}

 

Output:

Testing the program:

Invalid Date:

please enter a date = 31
please enter a month = 6
please enter a year = 2030

 Not a valid date

 

Previous Date:

please enter a date = 21
please enter a month = 6
please enter a year = 2030
Entered date = 21-6-2030
Previous date = 20-6-2030 

]]>
https://programmerbay.com/c-program-to-find-previous-date/feed/ 0
Design test cases and test the program of Quadratic Equation problem using Robustness testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-by-using-robustness-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-by-using-robustness-testing/#respond Sat, 19 Sep 2020 12:49:06 +0000 https://programmerbay.com/?p=5210 An equation is said to be a quadratic equation if only if it is in the form of ax2+bx+c where a can’t be 0. We will use the Quadratic formula for calculating the roots to check whether they are imaginary or real.

quadratic formula 1

This Quadratic formula is used only when b2– 4ac >= 0. such that, If b2– 4ac > 0 , means the equation has more than one real roots if b2– 4ac = 0 , means equal or single root if b2– 4ac <0, i3mplies imaginary root Lastly, if a is 0, then the equation would not be counted as a quadratic equation.

So, a quadratic equation can have [ Real, Equal, Imaginary, not quadratic ]

Program

Check out “Quadratic Equation” program along with its tested test cases.

Robustness Testing

We are assuming interval [0,10] where our input values will come in between and we will create test cases using Robustness testing accordingly.

In Robustness Testing, it will produce 6N+1 test cases which means, in this case, there will be 6*3+1 = 19 test cases.

Test IDabcExpected OutputProgram OutputTested Outcome
1-155Invalid InputInvalid InputPass
2055Not QuadraticNot QuadraticPass
3155RealRealPass
4955ImaginaryImaginaryPass
51055ImaginaryImaginaryPass
61155Invalid InputInvalid InputPass
75-15Invalid InputInvalid InputPass
8505ImaginaryImaginaryPass
9515ImaginaryImaginaryPass
10595ImaginaryImaginaryPass
115105EqualEqualPass
125115Invalid InputInvalid InputPass
1355-1Invalid InputInvalid InputPass
14550RealRealPass
15551RealRealPass
16559ImaginaryImaginaryPass
175510ImaginaryImaginaryPass
185511Invalid InputInvalid InputPass
19555ImaginaryImaginaryPass

How it is different from Boundary Value Analysis?

We can observe that previously we didn’t check for input values higher than the maximum boundary limit and lesser than the minimum boundary limit. In other words, we haven’t tested our code for Invalid Inputs in Boundary Value Analysis but in Robustness testing, we did make test cases for invalid inputs too and rewrite the code to fulfill this condition.

 

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-by-using-robustness-testing/feed/ 0
Difference Between White Box Testing And Black Box Testing In Tabular Form https://programmerbay.com/difference-between-black-box-testing-and-white-box-testing/ https://programmerbay.com/difference-between-black-box-testing-and-white-box-testing/#respond Tue, 25 Aug 2020 17:32:19 +0000 https://www.programmerbay.com/?p=4788 In Software testing, both are the testing techniques used to ensure the working of software as per the software requirement and specification. However, the main difference between them is, Black box testing mainly focuses on software behavior, whereas, White box testing mainly focuses on the internal operational flow or working of the software.

image 2020 12 27 015620

Black Box Testing

In black-box testing, the tester is not aware of the internal working and mechanics of the software system. This type of testing has an end-user appeal to it and the focus of this testing is more on the inputs and outputs obtained.

This technique uses software requirements and specifications as the base to drive test cases. It can be employed on every level of testing such as unit, integration, and system testing. The tester provides some input and expects a desirable output to verify the expected behavior of the software application. Therefore, it is also termed as Behavioral Testing

A Black Box Testing can be classified into three types, namely functional testing, non-functional testing, and regression testing.

Functional Testing: For functional requirements that involves testing of APIs ( such as Login, Payment Gateway), Database, GUI, and more.

Non-Functional Testing: For Non-Functional Requirements that involves testing of performance, scalability, and more

Regression Testing: It is done after any changes or update made in software to verify previously tested code is still working properly.

Equivalence Class Technique, Decision Tables Technique, Boundary Value Technique are some of the testing techniques that fall under the category of Black Box Testing.

White Box Testing

In white-box testing, the tester is well aware of the internal functioning and working of the software system. This type of testing is based upon checking each and every block of code and every possible condition. This nature of the testing acts like transparent testing, unlike the other testing methods.

In this, a tester examines the code of a software application in order to ensure the internal structures are implemented properly as per the software specification.

Statement Coverage, Decision Coverage, Condition Coverage are some of the testing techniques that fall under the category of White Box Testing.

Difference Between White Box Testing And Black Box Testing In Tabular Form :

Black box testingWhite box testing
Internal behaviour of the software is always unknownInternal behaviour of the software is known
It is High-level testingIt is Low level testing
Ideal for acceptance testing and system testingIdeal for integration testing and unit testing
No need to have any knowledge pertaining to coding / programmingShould have prior knowledge pertaining to coding / programming
Less time consumingMore time consuming
Also known as Behavioural testingAlso known as Structural testing
Done by TesterDone by Programmer
Implementation Knowledge isn't requiredImplementation Knowledge is required
Decision table testing, Equivalence partitioning and Cause–effect graph are some of the techniques that are used Statement Coverage and Branch coverage are some of the techniques that are used
Requirement specification is used as the base for test casesDetailed design is used as the base for test cases
It mainly focuses on the software functionality It mainly focuses on internal working of software
Functional, Non-functional and regression testing are the types of Black box testingCondition Testing, Loop Testing and Path Testing are the types of White box testing

Key Differences:

  • TESTING BASIS

In the case of black-box testing, the internal behavior of the software is always unknown while the emphasis is on the external factors like input and output; whereas; in the case of white-box testing, the internal behavior of the software is known and the tester can test each every part of the code.

 

  • TYPE OF TESTING

When we talk about black-box testing, since we are not concerned about internal working, that’s why, it is High-level testing; whereas; when we talk about white box testing, as we are aware of the internal functionality of the code, that’s why it is Low-level testing.

 

  • IDEAL USAGE

For the scenario related to Black box testing, as this testing is considered as higher level; this makes it ideal for acceptance testing and system testing; while; for the scenario related to white box testing, as this testing is considered as low level; this makes it ideal for integration testing and unit testing.

 

  • PROGRAM RELATED KNOWLEDGE

In the case of black-box testing, there is no need for the tester to have any knowledge pertaining to coding/programming; whereas; in the case of white-box testing, there is a prerequisite for the tester to have prior knowledge pertaining to coding/programming.

 

  • GRANULARITY

When we talk about black-box testing, this type of testing has very low granularity; whereas; when we talk about white box testing, this type of testing has quite high granularity.

 

  • TIME CONSUMPTION

If we consider the black box testing then, this testing is much less time consuming and also less exhaustive; whereas; if we consider white box testing then, this testing is much more time consuming and also more exhausting.

  • OTHER NAME

Black box testing is also termed as Behavioural testing, whereas White box testing also referred as Structural testing

]]>
https://programmerbay.com/difference-between-black-box-testing-and-white-box-testing/feed/ 0
Difference between Verification and Validation Testing in Tabular form https://programmerbay.com/difference-between-verification-and-validation-testing/ https://programmerbay.com/difference-between-verification-and-validation-testing/#respond Thu, 12 Dec 2019 06:18:55 +0000 https://programmerbay.com/?p=5707 Verification and validation is a process that identifies whether a software is developing as per the given requirements and specifications.

validation and verification

The basic difference between verification and validation testing is that, verification assures whether a product meets the specifications or not ,whereas, validation checks whether a product meets client’s requirement or not.

Difference between Validation and Verification Testing in Tabular form

Verification TestingValidation Testing
Main objective is to assure that product meets the designed specificationsMain objective is to assure that product meets the client’ requirements
This is done during the development phaseThis done after the development phase
This is carried out by the Quality Assurance (QA) teamThis is carried out by the Quality Checking (QC) team
It is static and proactive in natureIt is dynamic and reactive in nature
It does not involves testing of codesIt involves testing of code
It tests the software thoroughly without executing the codeIt tests the software by executing the code with the goal of finding defects and improve performance
The main goal of this testing method is to find bugs, ensuring the quality level of product and avoid defects.The main goal is to ensure the software work properly and meeting all the requirement and specification mentioned by the client
It supports techniques such as Inspection, walkthrough, Reviews and moreIt supports white box testing and black box testing techniques such as unit testing, integration testing, system testing, and Acceptance testing

Verification

“Are we building the product right?”

Definition: Verification is an approach of checking if the product that is being built is satisfying the imposed requirements and specifications, during the development phase.

Characteristics of Verification testing:

  • Discovering errors in early stages
  • Faster & Accurate
  • Responsible for detecting bugs

 

Validation

“Are we building the right product?”

Definition: Validation is an approach of checking if the product, built, meets the needs and requirements of the client, after the end of the development phase.

You would also like :

Difference between static testing and dynamic testing

]]>
https://programmerbay.com/difference-between-verification-and-validation-testing/feed/ 0
Difference between Static and Dynamic Testing in Tabular form https://programmerbay.com/difference-between-static-testing-and-dynamic-testing/ https://programmerbay.com/difference-between-static-testing-and-dynamic-testing/#respond Tue, 03 Dec 2019 08:47:58 +0000 https://programmerbay.com/?p=5625 Static and Dynamic testing are testing techniques that ensure quality and improved performance of a software.

Static Testing and Dynamic testing 2

The basic difference between static and dynamic testing is that Static testing doesn’t involve code execution, whereas , dynamic involves code execution to find bugs.

Difference between Static Testing and Dynamic Testing in Tabular form

Static TestingDynamic Testing
It tests the software thoroughly without executing the codeIt tests the software by executing the code with the goal of finding defects and improve performance
It focuses on documentationIt focuses on the testing of software operation
It refers to Verification testingIt refers to validation testing
The main goal of this testing method is to find bugs, ensuring the quality level of product and avoid defects.The main goal is to ensure the software work properly and meeting all the requirement and specification mentioned by the client
It is less time consuming and costly than Dynamic testing when it comes to testing changed productIt is time consuming and costly when it comes to test changed product. However, it can be reduced using the inspection process
It evaluates defects but not the failureIt evaluates defects as well as a failure too
It supports techniques such as Inspection, walkthrough, Reviews and moreIt supports white box testing and black box testing techniques such as unit testing, integration testing, system testing, and Acceptance testing
It mainly concentrates on defect prevention It mainly concentrates on defect correction

Static Testing

It is a testing technique in which changed code and its documentation is reviewed to ensure whether the implementation is made properly or not.

It involves requirement verification, design review, and code review. It has nothing to do with code execution. Its objective is to analyze the specification of software thoroughly.

In this technique, defect in software is discovered without program execution. The main goal of this testing method is to find bugs, ensuring the quality level of product and avoid defects.

Static testing and Dynamic testing 1 1

It can be classified in the following parts:

  • Review ( It is performed to find any type of defect in documents)
  • Static analysis ( It is performed with a set of tools in order to avoid possible defects that can be raised in software)

Characteristics of Static testing :

  • Discovering errors in early stages
  • Faster & Accurate
  • Responsible for detecting bugs

Dynamic Testing

It is a testing technique in which code is executed with a set of test cases to improve performance. It is done on software code in order to detect defects and code quality.

It is used to evaluate the final software and deals with the input and output of the software, checking whether the output as per expectations or not.

Static Testing and Dynamic testing

It can be classified in the following parts:
Black-box testing
White-box testing

Related Post:

Difference between validation and verification testing?

]]>
https://programmerbay.com/difference-between-static-testing-and-dynamic-testing/feed/ 0
Design the test cases and test the program of Triangle Problem by using Data Flow testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-data-flow-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-data-flow-testing/#respond Sat, 23 Nov 2019 10:15:05 +0000 https://programmerbay.com/?p=5505 In this article, we will formulate test cases for triangle problems using data flow testing in such a way that all the du and dc paths get covered. The first step is to generate flow graph from the code ( Here’s the code).

Same as path testing make flow graph.

path testing practical problem 1

Now, make Decision-to-Decision table in which consecutive nodes are counted as an individual.

path testing practical problem

On the basis of above table, create DD graph.

path testing practical problem 2

After DD graph, it is time to figure out du and dc paths. For this, create ‘ defined node and used at node’ table to view variable’s definition and initialization.

data flow testing triangle problem

From above table, find du and dc paths.

data flow testing triangle problem 1

Based on du and dc paths create test cases, covering each and every variable definition and usage.

Test IDabcExpected OutputProgram OutputTested Outcome
15105Not a triangleInvalid InputFail
21095Scalene triangleScalene trianglePass
3515Isosceles triangleIsosceles trianglePass
4555Equilateral TriangleEquilateral TrianglePass
5-155Invalid InputInvalid InputPass

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-data-flow-testing/feed/ 0
Design the test cases and test the program of Quadratic Equation by using Data Flow testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-by-using-data-flow-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-by-using-data-flow-testing/#respond Sat, 23 Nov 2019 08:05:42 +0000 https://programmerbay.com/?p=5492 Data flow testing doesn’t deal with the flow of the program, instead, it tracks which variable is used when. It means that it simply checks the initialization and usability of variables.

In this, we will drive test cases using Data flow testing approach by considering the Quadratic equation example. The first step is to create a flow graph from the code of the Quadratic Equation.

path testing data flow graph

Using the flow graph, create a Decision to Decision Graph ( DD Graph) by converting each set of consecutive nodes into a single node.

Path testing

Replace these numbers with correspondent DD nodes.

path testing DD graph

Create a Defined and Used node table to get a clear view of variable usage.

DU or DC for Quadratic equation

On the basis of the above table, we will generate du and dc path respectively.

DU or DC for Quadratic equation 2

All the ‘Y’ in the above table are DC path and ‘Path nodes’ are DU paths.

Now, create the test cases from input provided by the user in such a way that all the paths get covered.

Test IDabcExpected OutputProgram OutputTested Outcome
1055Not QuadraticNot QuadraticPass
2155RealRealPass
3955ImaginaryImaginaryPass
45105EqualEqualPass
5-155Invalid InputInvalid InputPass

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-by-using-data-flow-testing/feed/ 0
Design the test cases and test the program of Triangle problem by using Path testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-path-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-path-testing/#respond Fri, 22 Nov 2019 19:02:40 +0000 https://programmerbay.com/?p=5473 In this type of testing, test cases are drived by considering all the independent paths of the DD graph.

Here’s is the triangle problem code.

In path testing, first we create the flow graph of the triangle problem based on the program which shows the flow and possible paths.

path testing practical problem 1

Once the flow graph is created, with the help of it list all the consecutive nodes and assign an alphabet to them.path testing practical problem

After creating DD Table, it’s time to generate DD graph through which Cyclomatic complexity and the possible path will be gathered.

path testing practical problem 2

Using DD graph ( Decision to Decision graph ), calculate the cyclomatic complexity which tells all the independent paths.

Cyclomatic complexity = E – N + 2P

= 20-16+2

=6

Possbile paths are:

-A,B,C,D,E,F,G,K,L,M,O,P
-A,B,C,D,E,F,H,I,K,L,M,O,P
-A,B,C,D,E,F,H,J,K,L,M,O,P
-A,B,C,D,K,L,M,O,P
-A,B,C,D,K,L,M,N,O,P
-A,B,K,L,M,O,P

Based on these paths, we will create Test cases.

Test IDabcExpected OutputProgram OutputTested Outcome
15105Not a triangleInvalid InputFail
21095Scalene triangleScalene trianglePass
3515Isosceles triangleIsosceles trianglePass
4555Equilateral TriangleEquilateral TrianglePass
5-155Invalid InputInvalid InputPass
65511Invalid InputInvalid InputPass

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-path-testing/feed/ 0