There are no established methods for the systematic generation of test cases. Thus, at this paper, we will analyze, evaluate and recommend the strategy of automatic generation test cases method under different scenarios based on UML models.

Authors Avatar

Comp542: Group Research Paper                                                  

Comp542 OO Methods in

Information System Development

Group Research Paper

Title: Generate Test Case to Web Application with UML Model


Abstract

Object-oriented modeling techniques using the UML play an important role in software development. The definition of test cases is a particularly demanding part of every development process. Increasing the efficiency of obtaining test cases and coverage achieved by test cases will increase quality and productivity and reduce development time as well as costs.

Currently, there are no established methods for the systematic generation of test cases. Thus, at this paper, we will analyze, evaluate and recommend the strategy of automatic generation test cases method under different scenarios based on UML models.

Introduction

Object-oriented modeling techniques using the UML play an important role in commercial software development. Comprehensive testing is considered an obvious prerequisite for high software quality. The definition of test cases is a particularly demanding part of every development process. Currently, there are no established methods for the systematic generation of test cases based on UML models. Increasing the efficiency of obtaining test cases and coverage achieved by test cases will increase quality and productivity and reduce development time as well as costs. Furthermore, the use of UML models for purposes of generation encourages more extensive modeling. The information described in these models is of great use to requirements specification as well. The result is a threefold benefit: generating test cases with high efficiency and quality, more detailed information for requirements engineering, and – motivated by the more intense exploitation of the models – an encouragement for developers towards more in-depth modeling and precise maintenance of models.

There are different categories of tests:

1)        Methods for black box and white box testing, depending on whether or not the software’s internals are known and used as input for defining test cases,

2)        The distinction of unit, component, and system testing, specifying the level at which testing occurs,

3)        Tests classified by their aim, as distinguished by statistical, reliability-oriented testing vs. testing aimed primarily at fault detection.

In this paper, we will analyze, evaluate and recommend the strategy of automatic generation test cases method under different scenarios. We propose three approaches: Use Case, State Chart & Collaboration Diagram model.

The method for generating test cases based on UML models is described in below section. These approaches focus on state-based, interactive rather than data-processing systems. We expect it will able to be applicable to large and complex systems.


Section 2 Generating Test Cases from Use Cases

In a software development project, use cases define system software requirements. Use case development begins early on; so real use cases for key product functionality are available in early iterations. According to the RUP, a use case "…fully describes a sequence of actions performed by a system to provide an observable result of value to a person or another system using the product under development." Use cases tell the customer what to expect, the developer what to code, the technical writer what to document, and the tester what to test.

Use cases are based on the Unified Modeling Language (UML) and can be visually represented in use-case diagrams. Figure 1 shows a use-case diagram depicting requirements for a university course registration system.

Figure 1

The most important part of a use case for generating test cases is the flow of events. The two main parts of the flow of events are the basic flow of events and the alternate flows of events. The basic flow of events should cover what "normally" happens when the use case is performed. The alternate flows of events cover behavior of an optional or exceptional character relative to normal behavior, and also variations of the normal behavior. You can think of the alternate flows of events as "detours" from the basic flow of events.

 

Figure 2


2.1 Uses-Case Scenarios

A use-case scenario is an instance of a use case, or a complete "path" through the use case. End users of the completed system can go down many paths as they execute the functionality specified in the use case. Following the basic flow would be one scenario. Following the basic flow plus alternate flow would be another. The basic flow plus another alternate flow would be a third, and so on.

Table 1 lists all possible scenarios for the diagram shown in Figure 2, beginning with the basic flow and then combining the basic flow with alternate flows. These scenarios will be used as the basis for creating test cases.

 

Table 1: Scenarios for the Use Case Shown in Figure 2

2.2 Generating Test Cases

A test case is a set of test inputs, execution conditions, and expected results developed for a particular objective: to exercise a particular program path or verify compliance with a specific requirement, for example.

The purpose of a test case is to identify and communicate conditions that will be implemented in test. Test cases are necessary to verify successful and acceptable implementation of the product requirements.

We will describe a three-step process for generating test cases from a fully detailed use case:

  1. For each use case, generate a full set of use-case scenarios.

  1. For each scenario, identify at least one test case and the conditions that will make it "execute."

  1. For each test case, identify the data values with which to test.

Step One: Generate Scenarios

Read the use-case textual description and identify each combination of main and alternate flows -- the scenarios -- and create a scenario matrix. Table 2 shows a partial scenario matrix for the Register for Courses use case. This is a simple example with no nested alternate flows.

 

Table 2: Partial Scenario Matrix for the Register for Courses Use Case

Step Two: Identify Test Cases

Once the full set of scenarios has been identified, the next step is to identify the test cases. We can do this by analyzing the scenarios and reviewing the use case textual description as well. There should be at least one test case for each scenario, but there will probably be more. For example, if the textual description for an alternate flow is written in a very cursory way, like the description below,

3A. Unfulfilled Prerequisites, Course Full, or Schedule Conflicts

Then additional test cases may be required to test all the possibilities. In addition, we may wish to add test cases to test boundary conditions.

The next step in fleshing out the test cases is to reread the use-case textual description and find the conditions or data elements required to execute the various scenarios. For the Register for Course use case, conditions would be student ID, password, courses selected, etc.

Step Three: Identify Data Values to Test

To clearly document the test cases, a matrix format is useful, like Table 3. The first column contains the test case ID, the second column has a brief description of the test case, including the scenario being tested, and all other columns except the last one contain data elements that will be used in implementing the tests. The last column contains a description of the test case's expected output.

Join now!

Once all of the test cases have been identified, they should be reviewed and validated to ensure accuracy and to identify redundant or missing test cases. Then, once they are approved, the final step is to assign actual data values. Without test data, test cases can't be implemented or executed; they are just descriptions of conditions, scenarios, and paths. Therefore, it is necessary to identify actual values to be used in implementing the final tests.

Table 3: Test Case Matrix for the Register for Courses Use Case


Section 3 Using state diagram to generate Test cases

State ...

This is a preview of the whole essay