by Dinesh Thakur Category: Software Engineering

A test case provides the description of inputs and their expected outputs to observe whether the software or a part of the software is working correctly. IEEE defines test case as 'a set of input values, execution preconditions, expected results and execution post conditions, developed for a particular objective or test condition such as to exercise a particular program path or to verify compliance with a specific requirement.' Generally, a test case is associated with details like identifier, name, purpose, required inputs, test conditions, and expected outputs.

Incomplete and incorrect test cases lead to incorrect and erroneous test outputs. To avoid this, the test cases must be prepared in such a way that they check the software with all possible inputs. This process is known as exhaustive testing and the test case, which is able to perform exhaustive testing, is known as ideal test case. Generally, a test case is unable to perform exhaustive testing; therefore, a test case that gives satisfactory results is selected. In order to select a test case, certain questions should be addressed.

  1. How to select a test case?
  2. On what basis are certain elements of program included or excluded from a test case?

To provide an answer to these questions, test selection criterion is used that specifies the conditions to be met by a set of test cases designed for a given program. For example, if the criterion is to exercise all the control statements of a program at least once, then a set of test cases, which meets the specified condition should be selected.

The process of generating test cases helps to identify the problems that exist in the software requirements and design. For generating a test case, firstly the criterion to evaluate a set of test cases is specified and then the set of test cases satisfying that criterion is generated. There are two methods used to generate test cases, which are listed below.

  1. Code-based test case generation: This approach, also known as structure based test case generation, is used to assess the entire software code to generate test cases. It considers only the actual software code to generate test cases and is not concerned with the user requirements. Test cases developed using this approach are generally used for performing unit testing. These test cases can easily test statements, branches, special values, and symbols present in the unit being tested.
  2. Specification-based test case generation: This approach uses specifications, which indicate the functions that are produced by the software to generate test cases. In other words, it considers only the external view of the software to generate test cases. It is generally used for integration testing and system testing to ensure that the software is performing the required task. Since this approach considers only the external view of the software, it does not test the design decisions and may not cover all statements of a program. Moreover, as test cases are derived from specifications, the errors present in these specifications may remain uncovered.

Several tools known as test case generators are used for generating test cases. In addition to test case generation, these tools specify the components of the software that are to be tested. An example of test case generator is the 'astra quick test', which captures business processes in the visual map and generates data-driven tests automatically.

Test Case Specifications

A test plan is neither not related to the details of testing units nor it specifies the test cases to be used for testing units. Thus, test case specification is done in order to test each unit separately. Depending on the testing method specified in a test plan, the features of the unit to be tested are determined. The overall approach stated in the test plan is refined into two parts: specific test methods and the evaluation criteria. Based on these test methods and the criteria, the test cases to test the unit are specified.

For each unit being tested, these test case specifications describe the test cases, required inputs for test cases, test conditions, and the expected outputs from the test cases. Generally, it is required to specify the test cases before using them for testing. This is because the effectiveness of testing depends to a great extent on the nature of test cases.

Test case specifications are written in the form of a document. This is because the quality of test cases is evaluated by performing a test case review, which requires a formal document. The review of test case document ensures that test cases satisfy the chosen criteria and conform to the policy specified in the test plan. Another benefit of specifying test cases in a formal document is that it helps testers to select an effective set of test cases.

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.