Author: Max Sauer
Version: 5.0
Last update: 13.9.2005
Introduction: This document contains test specifications for JUnit module. You can use prepared
SampleProject or create a new one.
Comment: JUnit module is an extension to JUnit framework and serves in NetBeans IDE as support for creating unit tests of individual classes or whole packages. It generates skeletons of those unit tests and allows to run tests directly from tested classes or packages.
Purpose: This suite should check functionality of generating various JUnit test code.
Setup: It is supposed that you have created/opened a SampleProject with Main class and three other classes:
Knizka, Kolo, Vec which contain fields and methods for all access modificators (public, protected, default)
Purpose: This suite should check functionality of creating and generating various JUnit test code
Setup: It is supposed that you have created a SampleProject with Main class and 3 more classes in it:
Knizka, Kolo, Vec
#
Test case
Description
1
Create Empty Test
Invoke New File.. Wizard by pressing Ctrl+N or from ToolBar
Set "Project:" to SampleProject if it is not done already
Choose "Categories:" JUnit
and select "File Types:" Empy Test
Next> button should be enabled now. Press it.
Fill KnizkaTest in "Class Name:" and check check-boxes:
setUp, tearDown, Source Code Hints
RESULT:
a JUnit class KnizkaTest should be created under the node: SampleProject|Test Packages|sampleproject and opened in source editor.
2
Create Test for Existing Class
Follow steps 1-4 of previous test case, but choose Test for Existing Class as a "File Types:" And click Next > button
Click Browse... button and navigate to "Class to Test:" or just type its name Kolo into the text-field
Check-on/off some of the Method Accessors, Optional Code generation, Optional Comments
Click just enabled Finish button
RESULT:
It should create KoloTest class under SampleProject|Test Packages|sampleproject node and open it in the source Editor.
ATTRIBUTES: validation
3
Create Test Suite
Create new TestSuite via the 'New File...' dialog. (Ctrl-N)
Fill in "Class Name:", eg. MainTest
Check following check-boxes :
setUp, tearDown
Leave Source Code Hints unchecked
RESULT:
MainTest JUnit Test Suite class should be generated inside:
SampleProject|Test Packages|sampleproject
Purpose: To test opening of appropriate JUnit tests.
Setup: It is supposed that you have created/opened a SampleProject with Main class and three other classes in it:
Knizka, Kolo, Vec
, with "functional" JUnit Tests created.
#
Test case
Description
1
Open Test for selected class
Setup:Close all opened files in the Editor
From previous Test Suites, you should have had generated JUnit Test classes as a mirror of your real application. Select node: SampleProject|Source Packages|sampleproject|Kolo.java
Invoke Go To|Test (Ctrl+Alt-G)
RESULT:
The JUnit Test Class KoloTest should be opened and focused in the Editor.
Purpose: Testing of 'Test Project' JUnit feature.
Setup: It is supposed that you have created/opened a SampleProject with Main class and 3 other classes in it :
Knizka, Kolo, Vec
with "functional" JUnit Tests.
#
Test case
Description
1
Run Tests in Project
Select the SampleProject's root node in Projects tab.
Choose Test Project from its pop-up menu (Alt-F6)
RESULT:
Project should be build (together with JUnit Tests classes) and test should be executed. Results should be displayed in JUnit Test Results window and also printed in the Output Window. The 'Show All Resaults' button should be disabled.