Author: Daniel Mladek
Version: 1.0.0
Last update: 28.05.2004
Introduction: This document contains test specifications for JUnit module. You could use this prepared
SampleProject or create your one.
Comment: JUnit module is an extension to JUnit framework and serves in NetBeans IDE as a support for creating unit tests of individual classes or whole packages. It generates skeletons of those unit tests and allows to run tests from tested classes or packages.
Purpose: This suite should check functionality of generating various code of JUnit test
Setup: It is supposed that you have created a SampleProject (Desktop->J2SE Application project type) with Main class in it and other 3 more classes:
Knizka, Kolo, Vec which contains fields and methods for all access modificators (public, protected, default)
#
Test case
Description
1
Create SimpleJUnitTest with all method
Setup: Have open SampleProject and you have focus in Project TAB.
1. Select SampleProject|Source Packages|sampleproject|Knizka.java node 2. Invoke Tools|JUnit Tests|Create Tests popup-menu which should open Create Tests dialog 3. Let's have checked on all check-boxes of:
Method Accessors
Optional Code
Optional Comments
4. And click OK button
Teardown: Delete this just crated SampleProject|Test Packages|smapleproject|KnizkaTest.java
RESULT:
It should generate skeleton of JUnit Test class SampleProject|Test Packages|smapleproject|KnizkaTest.java
ATTRIBUTES: validation
2
Create SimpleJUnitTest for different modificators
1. Follow steps of previous test case but modify options in dialog. At least try these combinations: All checked, All unchecked, each checked only (for non-methods options check "Public Methods" option too).
RESULT:
Check generated sources
Repeat this TestCase several times
3
Create JUnit Test on package
Setup: Delete all previously created JUnit TestSuites
1. Select Sample Project|Source Packages|sampleproject package node 2. Invoke Tools|JUnit Tests|Create Tests popup-menu which should open Create Tests dialog 3. Check-on/off randomly check-boxes for Code Generation 4. Finally click OK button
RESULT:
It shuld create 4 JUnit TestSuit clasess:
KnizkaTest
KoloTest
MainTest
VecTest
under the node/package Test Packages|sampleproject
4
Create JUnit Test using expert options
Setup: Remove previously generated source code of JUnit test KnizkaTest.java
1. Change value of Expert properties in Main-menu: Tools|Options -> Options|Testing|JUnit Module Settings node to something else. 2. Create test and suite classes.
RESULT:
Generated source code should slightlt differ from previous code generated by TS 1.3.
Teardown: Remove all generated JUnit Tests generated by you in this Test Suite
Purpose: This suite should check functionality of creating and generating various code of JUnit test
Setup: It is supposed that you have created a SampleProject (Desktop->J2SE Application project type) with Main class in it and other 3 more classes:
Knizka, Kolo, Vec
#
Test case
Description
1
Create Empty Test
1. Invoke New File.. Wizard by pressing Ctrl+N or from ToolBar or Main-menu File|New File... 2. Set "Project:" to SampleProject if it is not done already 3. Choose "Categories:" JUnit 4. and select "File Types:" Empy Test 5. and click just enabled Next> button 6. Fill "Class Name:" to KnizkaTest and check-on check-boxes:
setUp, tearDown, Source Code Hints
RESULT:
a JUnit Testing class KnizkaTest has to be created under the node: SampleProject|Test Packages|sampleproject and opened in source editor.
2
Create Test for Existing Class
1. Follow steps 1-4 of previous test case, but choose Test for Existing Class as a "File Types:" And click Next > button 2. Click Browse... button and navigate to "Class to Test:" or just type its name Kolo into the text-field 3. Check-on/off some of the Method Accessors, Optional Code generation, Optional Comments 4. 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
1. Follows steps 1-4 of pre-previous test case 2.1, but now choose as "File Types:" Test Suite. And click Next > button. 2. Give "Class Name:", eg. MainTest 3. Check-on check-boxes :
setUp, tearDown
Source Code Hints left unchecked
RESULT:
It should generate MainTest JUnit Test Suite class under the node:
SampleProject|Test Packages|sampleproject
Purpose: You're validating if you could open "test" class for current class in Source Packages
Setup: It is supposed that you have created a SampleProject (Desktop->J2SE Application project type) with Main class in it and other 3 more classes:
Knizka, Kolo, Vec
And in previous TestSuite you successfuly made "functional" JUnit Tests.
#
Test case
Description
1
Open Test for selected class
Setup: Close all opened files in the Editor
1. From previous Test Suites you should have had generated JUnit Test classes as a mirror of your real application. So, select node: SampleProject|Source Packages|sampleproject|Kolo.java 2. Invoke on it popup-menu Tools|JUnit Tests|Open Test
RESULT:
The JUnit Test Class KoloTest has to open in the source Editor
Purpose: You have to check in this TestSuite if it is possible execute your already created JUnit Tests within the IDE and with which result.
Setup: It is supposed that you have created a SampleProject (Desktop->J2SE Application project type) with Main class in it and other 3 more classes:
Knizka, Kolo, Vec
And in previous TestSuite you successfuly made "functional" JUnit Tests.
#
Test case
Description
1
Run Tests in Project
1. Select the root SampleProject node in Projects TAB 2. Invoke on it popup-menu and choose Run Test
RESULT:
Project should be build (together with JUnit Tests classes) and your test has to be executed
ATTRIBUTES: validation
Teardown:
BTW: There's no special action on JUnit Test classes to execute them. In fact it is defined Ant Target deffined in Project build.xml script.
Purpose: This test suite contains test cases for accessibility.
Setup: Download a11y.jar and prepare your environment as this document instructs you.
#
Test case
Description
1
Check accessibility
1. Invoke all JUnit dialogs which are accessible from various places, eg. Popup-menu on a file/package, via Main-menu, etc. 2. Check dialog for accessibility. 3. Check all dialogs using previous actions.
RESULT:
There should be no A11Y bugs. See: A11Y homepage, JUnit module dialogs list.