TS 61 MobilityJMUnit
Mobility Pack Test Specification for JUnit Support
Author: Lukas Hasik
Version: 1.1
Lastupdate: 27.3.2008
Introduction: Test specification for JMUnit support in Mobility Pack. The JUnit support enables to user to generate tests for their classes in Mobile project.
Contents |
Test suite: Generating test skeletons
Purpose: Try the possibilities of the junit support
Setup: Have JMUnitTestingProject_TS_61_MobilityJMUnit.zip opened in NetBeans
- "Create JUnit Tests" on a Java Class
- Setup: Have a class with methods in Mobile project (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject/classTypes/PublicClass.java)
- Invoke the Tools > Create JUnit Tests on the class
- EXPECTED RESULT: The test skeletons are generated correctly. TestSuite midlet is added to MIDlets list (jad/jar).
- "Create JUnit Tests" on a MIDlet Class
- Setup: Have a MIDlet class in Mobile project (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject/allMIDPfileTypes/Midlet.java)
- Invoke the Tools menu on the class
- EXPECTED RESULT: The menu item Create JUnit Tests is missing.
- "Create JUnit Tests" on a package
- Setup: Have a package with files - classes, properties, midlets, etc. - in Mobile project (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject/allMIDPfileTypes)
- Invoke the Tools > Create JUnit Tests on the package
- Leave all the checkboxes in Create Tests dialog selected
- EXPECTED RESULT: The test skeletons are generated only for java classes. The MIDlet classes and other file types are ignored.
- "Create JUnit Tests" on a "Source Packages" node
- Setup: Have a mobile project with packages with files - classes, properties, midlets, etc. (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject)
- Invoke the Tools > Create JUnit Tests on the "Source Packages" node
- Leave all the checkboxes in Create Tests dialog selected
- EXPECTED RESULT: The test skeletons are generated only for classes. The MIDlet classes and other file types are ignored.
Test suite: Options of "Create Tests" dialog
Purpose: Try the possibilities of the dialog
Setup: Have JMUnitTestingProject_TS_61_MobilityJMUnit.zip opened in NetBeans
- "Create JUnit Tests" only public
- Setup: Have a mobile project with class with different methods access (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject/allReturnTypes/DifferentAccessLevels.java)
- Invoke the Tools > Create JUnit Tests on the "DifferentAccessLevels.java" node
- Select only the Public checkbox in Method Access Level area in Create Tests dialog
- EXPECTED RESULT: The test skeletons are generated only for the public methods.
- "Create JUnit Tests" only protected
- Setup: Have a mobile project with class with different methods access (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject/allReturnTypes/DifferentAccessLevels.java)
- Invoke the Tools > Create JUnit Tests on the "DifferentAccessLevels.java" node
- Select only the Protected checkbox in Method Access Level area in Create Tests dialog
- EXPECTED RESULT: The test skeletons are generated only for protected methods.
- "Create JUnit Tests" only package private
- Setup: Have a mobile project with class with different methods access (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject/allReturnTypes/DifferentAccessLevels.java)
- Invoke the Tools > Create JUnit Tests on the "DifferentAccessLevels.java" node
- Select only the Package Private checkbox in Method Access Level area in Create Tests dialog
- EXPECTED RESULT: The test skeletons are generated only for package private methods.
- "Create JUnit Tests" only package private classes
- Setup: Have a mobile project with package private classes (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject/classTypes/PackagePrivateClass)
- Invoke the Tools > Create JUnit Tests on the "classTypes" node
- Select only the Package Private Classes checkbox in Class Types area in Create Tests dialog
- EXPECTED RESULT: The test skeletons are generated only for package private classes and public classes.
- "Create JUnit Tests" only abstract classes
- Setup: Have a mobile project with abstract classes (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject/classTypes/AbstractClass)
- Invoke the Tools > Create JUnit Tests on the "classTypes" node
- Select only the Abstract Classes checkbox in Class Types area in Create Tests dialog
- EXPECTED RESULT: The test skeletons are generated only for abstract classes and public classes.
- "Create JUnit Tests" only exception classes
- Setup: Have a mobile project with exception classes (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject/classTypes/ExceptionClass)
- Invoke the Tools > Create JUnit Tests on the "classTypes" node
- Select only the Exception Classes checkbox in Class Types area in Create Tests dialog
- EXPECTED RESULT: The test skeletons are generated for only exception classes and public classes. T
- Regenerate tests when new method added
- Setup: Have a mobile project with a class. Generate test skeleton for this class.
- Add new method to the class
- Invoke the Tools > Create JUnit Tests for the class again
- EXPECTED RESULT: The test class is updated with new test method. The skeleton is enhanced with tests for new methods.
- Two Methods With Same Name
- Generate test for class with methods sameNameMethod, SameNameMethod (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject/samename)
- The class is in samename package of the test project
- EXPECTED RESULT: The test method testSameNameMethod isn't generated/called twice
- Two Methods With Same Name And Different Parameters
- Setup: Have class with methods sameNameDifferentParameters(), sameNameDifferentParameters(int i) (JMUnitTestingProject_TS_61_MobilityJMUnit.zip/JMUnitTestingProject/samename)
- Generate test for the class
- EXPECTED RESULT: The test method testSameNameDifferentParameters() isn't generated/called twice
Test suite: Create Test From New File Wizard
Purpose: Test the newEmptyJ2MEUnitTest template
Setup: Have a mobility project opened in NetBeans
- Create Empty J2ME Unit Test
- Invoke the New > Others > MIDP > Empty J2ME Unit Test
- Specify name and package
- EXPECTED RESULT: The test skeletons with the name is generated into the package. The JMUnit4CLDC10 library is add in project properties.