Test cases and test suites

A test case answers the question: What am I going to test? You develop test cases to define the things that you must validate to ensure that the system is working correctly and is built with a high level of quality. A test suite is a collection of test cases that are grouped for test execution purposes.

Test cases

A typical use of test case might be to use the same test script for testing multiple configurations. For instance, if you want to test a login script on three different browsers, such as Firefox, Internet Explorer, and Safari, you can create three different test case execution records in that test case. In a test case that is called Test Browsers you might include three testing scenarios:
  • Test case execution record 1: Firefox and log-in test script
  • Test case execution record 2: Internet Explorer and log-in test script
  • Test case execution record 3: Safari and log-in test script

Test suites

If each test case represents a piece of a scenario, such as the elements that simulate a completing a transaction, use a test suite. For instance, a test suite might contain four test cases, each with a separate test script:
  • Test case 1: Login
  • Test case 2: Add New Products
  • Test case 3: Checkout
  • Test case 4: Logout

Test suites can identify gaps in a testing effort where the successful completion of one test case must occur before you begin the next test case. For instance, you cannot add new products to a shopping cart before you successfully log in to the application. When you run a test suite in sequential mode, you can choose to stop the suite execution if a single test case does not pass. Stopping the execution is useful if running a test case in a test suite depends on the success of previous test cases.

Test suites are also useful for the following types of tests:
  • Build verification tests: A collection of test cases that perform a basic validation of most the functional areas in the product. The tests are executed after each product build and before the build is promoted for use by a larger audience.
  • Smoke tests: A collection of test cases that ensure basic product functionality. Typically, smoke tests are the first level of testing that is performed after changes are made to the system under test.
  • End-to-End integration tests: A collection of test cases that cross product boundaries and ensure that the integration points between products are exercised and validated.
  • Functional verification tests: A collection of test cases that focus on a specific product function. Executing this type of test with a test suite ensures that several aspects of a specific feature are tested.
  • Regression tests: A collection of test cases that are used to make a regression pass over functional product areas.

Test scripts

Each test case is typically associated with a test script, although you can run a test with no associated test script.

A test script is a manual or automated script that contains the instructions for implementing a test case. You can write manual test scripts to be run by a human tester, or you can automate some or all of the instructions in the test script. You can also associate automated functional test scripts, performance test scripts, and security test scripts with a test case.

Test cases with multiple test scripts

You can also associate more than one test script with a single test case, but you should do this only if each test script associated with the test case provides a different way to test the scenario in the test case. For example, a test case might require several scripts to test the scenario in different test environments. Or, you might have both manual and automated scripts that can be used to exercise the test case.

Do not use test cases to group test scripts that exercise different aspects of a common function or you might see incorrect information about test results and attempted points. For example, if you run a test case for a specific test plan, iteration, and test environment and specify a different functional script each time, the last result of the test case execution record only captures the results of the last script run.

In some cases, you may also want to use test suites to group related test cases. For example, you can use a suite to run a set of automated regression test cases together or to sequentially run a set of test cases that comprise an end-to-end scenario. With a test suite, you can plan, initiate, and track the execution of the related test cases that make up the larger scenario that is tested by the test suite.

Test case and test suite sections

Table 1 lists the default sections that are included in test cases and test suites.

Table 1. Test case and test suite default sections
Test Case Test Suite
Summary Summary
Test Case Design Test Suite Design
Formal Review Formal Review
Development Items Pre-Condition
Requirements Links Post-Condition
Risk Assessment Risk Assessment
Pre-Condition Expected Results
Post-Condition Test Cases
Expected Results Test Suite Execution Records
Test Scripts Attachments
Test Case Execution Records Execution Variables
Attachments  
Execution Variables  

Each section includes its own editor. Some sections, consist of a rich-text editor with common formatting for features such as tables, fonts, bullets, and numbered lists.

Other test case sections provide links to these other test artifacts.

The Test Cases section of a test suite looks similar to the Test Cases section of a test plan; however, there are important differences in the Test Script column. When several test scripts are associated to a test case, the Test Script column in a test plan's Test Cases section shows links to all test scripts associated with a test case. In a test suite's Test Cases section, only one test script is shown: the test script that you set as the default test script during the test suite execution.

You can add your own sections and remove unneeded sections by using the Manage Sections feature.

Weight and categories of test cases and test suites

Test case and test suite categories are used in the Summary section of a test case or test suite.

You can use test case and test suite categories to help group your test cases or test suites logically. Later, when you can browse to list all your test cases or test suites, you can sort the list by using the categories.

Four default categories are provided: category, function, iteration, and theme. You can add your own categories, functions, iterations, and themes and types of categories.

Weight is a measurement of results not a measurement of time. You can use it flexibly, but for time measurements use the estimate and time spent.

Custom attributes for test case and test suites

If an administrator defined custom attributes for test cases or test suites, they are listed in the summary.

Like categories, custom attributes can be used as a grouping, sorting, and filtering mechanism to organize a test project into logical hierarchies of artifacts in your test project. Categories are restricted to text format; however, using custom attributes can include text, integer, and date formats. Custom attribute values are free-form so you can use any data that you need for test artifacts.

Templates

Test cases and test suites are based on templates. When you create a test case or test suite, you base it on a template. You can use the default templates, create new templates, and designate default templates.

Templates contain a collection of sections. You create a template by adding and removing provided sections or creating new sections. If the section names do not match what you are accustomed to, create new sections and add them to a template.

Each test organization can design their own custom test templates.

Preconditions and postconditons

Conditions provide information for the person who runs a test. Use preconditions to communicate requirements that must be met before the tester can run the test case or test suite. Use postconditions to communicate requirements that must be met after the tester runs the test case or test suite.

Test cases, test suites, and test execution

Test cases are integral to the test execution process. To run a test, you can do any of these things:

  • Run a test case.
  • Combine several test cases into a test suite, and run the test suite.
  • Generate test case execution records or test suite execution records to define the environmental attributes for running the test, and then run them.