Jtest logo




Contents  Previous  Next  Index

Performing Black-Box Testing


Jtest performs black-box testing, along with all other appropriate types of testing, each time that you test a class or set of classes.

Jtest will automatically create and execute test cases that verify code functionality when specification information is incorporated into the code using the Design by Contract language. For information on adding Design by Contract-format contracts to your code, see Using Design by Contract With Jtest and The Design by Contract Specification Language.

Jtest will also check functionality using any test cases you have added as well as any automatically-generated test cases whose outputs you have validated.

Important: In order to perform black-box testing, Jtest needs to know the location of your JDK. Jtest determines this location automatically. For information on changing the JDK used, see JDK Requirement

To perform black-box testing:

  1. Open the appropriate UI for your test. The Class Testing UI is used to test a single class; the Project Testing UI is used to test a set of classes.
    • The Class Testing UI opens by default when Jtest is launched.
    • The Project Testing UI can be opened by clicking the Class Testing UI's Project button.
  2. If a class or set of classes is already loaded into the UI you are using, click the New button to clear the previous test.
  3. Use the Browse button to indicate what class or set of classes you want to test.
  4. (Optional) Add test cases by adding method inputs and/or Test Classes.
  5. Test the class or project by clicking the Start button.
    • If you only want to perform dynamic analysis, right-click the Start button, then choose Dynamic Analysis from the shortcut menu.
    • If you only want to execute automatically-generated test cases, right-click the Start button, then choose Dynamic Analysis> Automatic from the shortcut menu.
    • If you only want to execute user-defined test cases, right-click the Start button, then choose Dynamic Analysis> User Defined from the shortcut menu.

Jtest will then run all requested tests.

If the classes under test contain Design by Contract specification information, any functionality problems found will be reported in the Design by Contract Violations branch of the Errors Found Panel (if you tested a single class) or the Results Panel (if you tested a project).

If you added user-defined test cases, you should evaluate the outcomes for all tested classes and specify the correct output values for test cases that failed.

To evaluate test case outcomes for a class:

  1. Review the class's test case outcomes in the View Test Cases window.
    • To open this window from the Class Testing UI, click the View Test Cases button.
    • To open this window from the Project Testing UI's Results panel, right-click the [Class Name] node, then choose View Test Cases from the shortcut menu.
  2. In the View Test Cases window, expand the test case tree so that the inputs and outcomes for the test cases you are evaluating are visible.
  3. Indicate whether or not the outcome for each test case is correct by right-clicking the appropriate outcome, then choosing the appropriate option.
    • Choose Mark as Correct if the listed outcome is the expected outcome.
    • Choose Mark as Incorrect if the listed outcome is not the expected outcome.
    • Choose Mark as Unknown if you don't know how the listed outcome compares to the expected outcome.
    • Choose Mark as Ignore if you want Jtest to ignore the listed outcome.
    • To choose the same option for all of a test case's outcomes, right-click the test case's Outcomes leaf, then choose the appropriate Set All to... command from the shortcut menu.
  4. If any outcome was incorrect, enter the correct value by:
    1. Opening the Class Test Parameters window.
    2. Opening that test case's branch in Dynamic Analysis> Test Case Evaluation> Specification and Regression Testing.
    3. Right-clicking the outcome, choosing Edit from the shortcut menu, then entering the correct value in the text field that opens.

Now every time Jtest is run on that class, it will check whether or not the correct outcomes are produced.

Any problems found using these test cases will be reported in the Specification and Regression Errors branch of the Errors Found Panel (if you tested a single class) or the Results Panel (if you tested a project).

Related Topics

About Black-Box Testing

Adding Method Inputs

Adding Test Classes

Specifying Imports

Using Design by Contract With Jtest

The Design by Contract Specification Language

Testing A Class - Two Simple Examples

Jtest Tutorials


Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft