Getty Images

Tip

How to make use of specification-based test techniques

Specification-based techniques can play a role in efficient test coverage. Choosing the right techniques can ensure thorough coverage, while eliminating redundancy.

When challenged with assessing the quality of an application, testers must first design an effective and efficient test strategy. The specific test techniques employed in test strategies depend on the type of application and the specifics of what is being validated. Test techniques provide a framework for full test coverage of each acceptance criteria, as well as offering a focus on the areas where defects are most likely to cluster.

White box test techniques are used in the unit and component levels of testing for early identification of defects. Black box techniques are used in functional and systems testing. Within black box testing, there are specification-based techniques and experience-based techniques. Specification-based techniques are used for effective and efficient testing of the specifications, while experienced-based techniques explore the potential edge cases and are based on use cases and customer experience.

In this tip, learn about specification-based test techniques, including how and when to employ them.

Primary specification-based test techniques

The most important and most frequently used of the specification-based techniques are the following:

  • Negative testing.
  • Equivalence partitioning.
  • Boundary value testing.

These techniques are applicable for testing almost all types of applications.

Negative testing

Although it is not necessarily considered an advanced test technique, negative testing is a critical component of test design for all types of applications. Think about when a tester asks, "How did I miss that bug?" The answer is often found in missed negative tests. Negative testing simply ensures that the application does not do something it is not intended to do.

For almost every positive test case -- those that test that the application does what it is specified to do -- there should be a negative test to validate the opposite. A negative test case can be as simple as ensuring a field that accepts only alphabetical characters does not accept numbers or special characters. More complex negative tests look at how a data load is affected if an interface does not complete in the allotted time. It's best to take a creative approach when developing these tests.

Negative testing vs. positive testing
How negative test cases compare to positive test cases

Equivalence partitioning

Equivalence partitioning is a test technique to create a more efficient test suite. This technique involves organizing test data into groups called equivalence classes. Since the data in each class should generate the same result, you can run fewer tests.

This technique begins with the correct identification of classes. Determine the data scenarios that generate the same outcome within the application. Testers need to have a deep understanding of the requirements, especially when the requirements are complex. Inaccurate or missed partitions can easily result in missed defects.

Once the equivalence classes are established, valid and invalid values are assigned to each class. The invalid values are important since they are the negative tests. Each value must be tested separately so that defects are not masked.

The equivalence partioning technique is most effective when the test effort involves many data combinations. This can drastically reduce the amount of testing needed, which reduces both test time and cost without reducing test coverage.

This technique may not be appropriate for health- and safety-critical domains, which require more in-depth testing.

Boundary value testing

The boundary value test technique is a special case of equivalence partitioning. Bugs often cluster around entry and exit points in code, so boundary value testing is a great way to expose these bugs. Boundary value testing means testing not just the expected value, but the values just below and just above that value. The value outside the expected range is the negative test.

This is a great way to test business rules. For example, if a child must be under 4 feet tall to qualify for a discounted rate, test 3 feet, 4 feet and 5 feet. Or, to be more precise, test 3 feet, 11 inches; 4 feet; and 4 feet, 11 inches.

The complexity with this type of testing is in choosing the correct boundary values. Work with developers to understand exactly what the boundary value limits are. If the correct boundary value limits are not tested, the tests do not effectively catch bugs. Although boundary value testing is easy to automate, an application with complicated calculations of many business rules means boundary value testing can generate lots of test cases. In these situations, equivalence partitioning can help to reduce the number of test cases.

Specification-based test techniques for special circumstances

Decision tables and state transition testing are test techniques that are used for specific test conditions.

Decision tables

Decision tables are used for testing complex systems where there are numerous combinations. The potential inputs and results are set up in tables to ensure complete test coverage without creating duplicate tests.

In some circumstances, it is more practical to set up a decision table as a cause-and-effect diagram, or a fishbone diagram. Cause-and-effect diagrams are used to provide a visual interpretation of the requirements. Although it can take some time to create, these diagrams can explain potential areas of defects and can ensure efficient testing by avoiding duplication.

State transition testing

State transition testing is a specialized test technique used to verify that the states of the data within the application change according to requirements. This is a great technique to test applications that have complex data flows. To implement state transition testing, create a diagram with four columns, states, transitions, events and actions. This is an effective technique for understanding the end-to-end behavior of the system under testing.

Dig Deeper on Software testing tools and techniques

Cloud Computing
App Architecture
ITOperations
TheServerSide.com
SearchAWS
Close