Requirements Traceability: Test Cases and their Relationship with Use Cases

I have found that it is difficult to describe the full purpose of test cases without explaining their linkage to use cases. Test cases typically rely on use cases to help ensure that the system functionality delivered accurately represent the actual features requested by the business. Per Wiki – In software development, the term traceability (or Requirements Traceability) refers to the ability to link product requirements back to stakeholders’ rationales and forward to corresponding design artifacts, code, and test cases.

 

Ideally, during the early stages of the development process the analysts will create a list of use cases (user stories) based on the requirements provided by the client. These cases are a fundamental and valuable element for the development team since they will provide a clear idea of the functionality that should be implemented in order to satisfy the requirements.

 

Normally, business analysts or designers are responsible for the creation of the use cases from the requirements, since they should be created early in the project during the design stage.

 

These are the main sections of a use case:

  • Unique identifier, normally it is a numerical id, however it could be a unique group of letters that identify the use case. The important thing is to have a standard that is going to allow the QA team to track it, allowing it to be easy to find and modify in the future.
  • Description, it basically explains what is going to be covered. It is a summary of the requirements that are included in this use case, the description should not have more than two or three lines.
  • Preconditions, conditions that are required in order to have a successful scenario. This section is really important to avoid ambiguity, it clearly defines the circumstances under the scenario will have an expected behavior. It should be written using past tense.
  • Post conditions, conditions that will be true after all the steps of the scenario are executed. That means that if any of these conditions fails the use case and the requirements are not working correctly, it should be written using present perfect verb tense.
  • Steps, a list of instructions that should be followed, each step in this list must be unique and numerated.
  • Requirements, although this is an optional section, it is used for the analyst to create a link between the use case and the list of requirements that are being covered by the use case.

 

Example:

 

ID: UC-2509

Description:

User is going to modify his password and email.

Preconditions:

  • User has successfully login into the application.
  • User account has already being verified.

Postconditions:

  • Email has been updated.
  • Password has been updated

Steps:

  1. User selects option of change profile settings.
  2. User types new email, and new password.

 

The Quality assurance team will be responsible for the creation of the test cases towards the end of analysis and design phase and at the beginning of the implementation stage, normally relying on the use cases and the GUI design as their primary source.

 

Not following this timing often causes problems – sometimes delivery teams do not begin creating until after they finish the development of source code, missing errors and issues that could have been caught earlier, impacting the project budget and timeline.

 

Test cases are similar to the use cases with the main difference that the tester uses GUI components in order to describe the steps or conditions of a scenario. At this point the tester has the GUI design available, so that they are aware of the specific elements and data that can be used in the test case.

 

The following would be the test case for the previous use case that was presented above:

 

ID: TC-2506

Description:

User is going to modify his password and email.

Preconditions:

  • User has successfully login into the application.
  • User account has already being verified.

Postconditions:

  • Email has been updated.
  • A message has been displayed telling the user that the email has been successfully updated.
  • Password has been updated.
  • A message has been displayed telling the user that the password has been successfully updated.

Steps:

  1. User clicks on profile button on the upper right corner of the site.
  2. User types new email, and new password.
  3. User click on save button.
  4. System displays confirmation messages on the lower right corner of the site.

Author:

Alexander Chaves
Team Lead – Quality Assurance