st – Programmerbay https://programmerbay.com A Tech Bay for Tech Savvy Tue, 20 Sep 2022 08:56:15 +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 st – Programmerbay https://programmerbay.com 32 32 Distinguish between single and multiple fault assumption https://programmerbay.com/distinguish-between-single-and-multiple-fault-assumption/ https://programmerbay.com/distinguish-between-single-and-multiple-fault-assumption/#respond Wed, 14 Sep 2022 05:48:12 +0000 https://programmerbay.com/?p=5525 Here’s the difference between single and multiple fault assumption.

 

Single fault assumptionmultiple fault assumption
Single fault assumption describes that two or more simultaneous faults are hardly responsible for the failureMultiple fault assumption defines two or more simultaneous faults can be the reason for failure
In this, only single variable is set to its extreme value and letting others to their nominal valuesIn this, more than one variable is assigned with extreme values
For example, Normal Boundary Value testingFor example, Worst-Case Boundary Value Testing

What is Boundary Value testing:

It is a functional testing technique. In this, we choose boundary values or conditions where the chances of getting errors are high, These boundary values are the input values which can be:

  • minimum ( lying on the boundary)
  • maximum (lying on the boundary)
  • Just below from maximum ( below the boundary)
  • Just above to minimum (above the boundary)
  • At nominal

]]>
https://programmerbay.com/distinguish-between-single-and-multiple-fault-assumption/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
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
Design the test cases and test the program of Quadratic Equation problem using Path testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-using-path-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-problem-using-path-testing/#respond Fri, 22 Nov 2019 10:59:03 +0000 https://programmerbay.com/?p=5453 In this article, we will perform path testing on the quadratic equation program (Here’s the code) in order to generate test cases.

The first step is to create a flow graph using quadratic equation program.

path testing data flow graph

After creating the flow graph, it’s time to make a Decision-to-Decision Graph (DD Graph). List one by one consecutive nodes and assign an alphabet.

Path testing

Generate a DD graph.

path testing DD graph

Now, calculate cyclomatic complexity which represent the number of possible paths,

=E − N + 2P

=16-13+2

=5

After calculating cyclomatic complexity, generate independent paths.

– A,B,D,F,H,I,J,L,M
– A,B,D,F,G,I,J,L,M
– A,B,D,E,I,J,L,M
– A,B,C,I,J,L,M
– A,B,C,I,J,K,L,M

The last step is to formulate test cases based on the calculated independent paths.

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-problem-using-path-testing/feed/ 0
Design the test cases and test the program of Triangle Problem by using Decision Table Based testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-decision-table-based-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-decision-table-based-testing/#respond Fri, 27 Sep 2019 07:36:47 +0000 https://programmerbay.com/?p=5397 Program

If you’re curious to see the “Triangle Problem “ code, then the link is here with tested test cases.

Decision Table Based Testing

In Decision table based testing,  Condition stubs and Action stubs are viewed as inputs and outputs. Here, we’ll be applying this Structural testing technique to create test cases:

Let’s create the decision table first,

new dtbt

On the basis of above decision table, we have these test cases for testing:

Test IDabcExpected OutputProgram OutputTested Outcome
15105Not a triangleNot a trianglePass
21055Not a triangleNot a trianglePass
35510Not a triangleNot a trianglePass
41095Scalene triangleScalene trianglePass
5515Isosceles triangleIsosceles trianglePass
6155Isosceles triangleIsosceles trianglePass
7---Not PossibleNot Possible
8551Isosceles triangleIsosceles trianglePass
9---Not PossibleNot Possible
10---Not PossibleNot Possible
11555Equilateral TriangleEquilateral TrianglePass

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-triangle-problem-by-using-decision-table-based-testing/feed/ 0
Design the test cases and test the program of Quadratic Equation by using Decision Table Based testing https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-by-using-decision-table-based-testing/ https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-by-using-decision-table-based-testing/#respond Fri, 27 Sep 2019 06:01:49 +0000 https://programmerbay.com/?p=5388 Program

If you’re interested to see “Quadratic Equation Problem “ code, then the link is here with tested test cases.

Decision Table Based Testing

In Decision table based testing,  Condition stubs and Action stubs are recognized as inputs and outputs. Here, we’ll be using this black box testing technique to generate test cases:

Let’s create the decision table first,

Desicion Table testing 1

Now, we will accordingly create test cases based on the above decision table.

Test IDabcExpected OutputProgram OutputTested Outcome
1055Not QuadraticNot QuadraticPass
2155RealRealPass
3955ImaginaryImaginaryPass
45105EqualEqualPass

]]>
https://programmerbay.com/design-the-test-cases-and-test-the-program-of-quadratic-equation-by-using-decision-table-based-testing/feed/ 0