How to Create Test Cases for SysML Requirement?

Requirement diagram is a useful tool for recording, describing and organization both functional and non-functional requirements of a system. In addition, you can describe how the requirements will be verified with test cases. In this tutorial, we will create a requirement, and then add test cases for validation. Finally, we will walk you through the steps required to produce a report of requirements.

February 16, 2016
Views: 64,706
PDF Download
Compatible: Enterprise, Professional

Creating a Simple SysML Requirement Diagram

  1. Select Project > New from the application toolbar.
  2. In the New Project window, enter Tutorial as the Name.
    New project
  3. Click Create Blank Project.
  4. Create a SysML requirement diagram first. You can create a requirement diagram by selecting Diagram > New from the application toolbar. Select Requirement Diagram in the New Diagram window and then click Next. Click OK again to create the diagram.
    New requirement diagram
  5. Click a requirement Support registration.
    Requirement shape created

Creating Test Cases

Let's create some test cases for the requirement Support registration.
  1. Move your mouse pointer over the requirement.
  2. Click on the Resource Catalog icon and drag it out.
    Using Resource Catalog
  3. Release the mouse button. Select Verify <- Test Case from the Resource Catalog.
    Create test case
  4. Name the test case as Test Age Input.
    Test case created
  5. In addition to having a named test case shape, you can also define the steps to test. Open the specification by right-clicking on the test case Test Age Input and selecting Open Specification... from the popup menu.
  6. Open the tab Test Plans. There are three columns. The Steps column defines a set of steps to test the requirement in a more general way. The Procedures column also defines the steps, but in a more concrete manner by providing test data. The Expected Results column is the result expected to be achieved by walking through the defined procedures.
    Test Plan
  7. Enter the steps as shown below:
    Step Procedure Expected Result
    Enter user information Enter:
    - User name: john
    - Age: 20
    Entered data appear in form
    Submit the form Click the submit button Prompt: Application is submitted

    The screen should look like this:
    Steps entered
  8. Click OK to confirm.
  9. Create another test case to test invalid age input. Repeat the previous steps to create the test case Test Invalid Age Input from the requirement Registration Form.
    Another test case created
  10. Enter the test plan as shown below:
    Step Procedure Expected Result
    Enter user information Enter:
    - User name: john
    - Age: -1
    Entered data appear in form
    Submit the form Click the submit button Prompt: Invalid age. Please re-enter.

    The screen should look like this:
    Steps entered

Producing a Document of Requirements and Test Cases

In this section, you are going to produce a Word document that contains the details of requirements and test cases.
  1. Select Tools > Doc. Composer from the application toolbar.
  2. Select Build Doc from Scratch.
    Select Build Doc from Scratch
  3. Find the requirement diagram in Diagram Navigator. Click on the diagram and drag it onto the document.
    Drag requirement diagram to document
    Your document should look like this:
    Document
  4. Click on the requirement Support registration in Diagram Navigator and then drag it onto the document.
    Drag requirement to document
    Your document should look like this:
    Basic requirement info in document
  5. Select the two test cases in Diagram Navigator.
    Multiple select test cases
  6. Select the Details template under the Template pane and then drag it onto the document.
    Drag the Details template to document
    Finally, your document should look like this:
    Final document
  7. Click on Export > Word Document... at the top right of Doc. Composer.
    To export Word document
  8. In the Export Word Doc. window, provide the output path of the .docx file to be exported and then click Export at the bottom right.
    Export Word Doc window
    Open the Word file. You can obtain a detailed requirement specification with test cases defined, like this:
    Exported Word document
  9. Save the project. This is the end of the tutorial.