Difference between revisions of "DSDP/TM/JUnittests Framework Documentation"
|Line 50:||Line 50:|
== Writing DSDP-TM JUnit tests ==
== Writing DSDP-TM JUnit tests ==
Revision as of 13:16, 30 December 2006
- 1 Hitch-Hacker's Guide to Using and Writing DSDP-TM (aka RSE) JUnit tests
- 2 Using the DSDP-TM JUnit tests
- 3 Writing DSDP-TM JUnit tests
- 3.1 Where to put a new test suite or test case?
- 3.2 Which base class should a test case inherit from?
- 3.3 RSECoreTestCase features in detail
- 3.4 RSEBaseConnectionTestCase features in detail
Hitch-Hacker's Guide to Using and Writing DSDP-TM (aka RSE) JUnit tests
This page is giving a introduction to the usage of the DSDP-TM JUnit tests framework as well as providing How To's and short descriptions of the features available in the framework for JUnit test developers.
Note: The page is under on-going maintenance and will be updated if the framework is changed or extended!
Using the DSDP-TM JUnit tests
Using means running the test cases either within a target platform Eclipse or within the currently executing Eclipse instance. There is basically only one question to distiguish between the two use cases:
Do you only use RSE within your currently running Eclipse environment for remote system connectivity or do you develop plugin(s) based on RSE and/or using RSE API?
- If you answer I develop plugin(s) using RSE API and/or I contribute/plan to contribute actively to RSE. -> see section 2.1
- If you answer I only use RSE within my running Eclipse for accessing remote systems. -> see section 2.2
- If you cannot answer the above question clearly (because you may simple fall in both user groups at the same time), you may choose the use case with can serve your needs most efficiently.
Launching the DSDP-TM JUnit tests as JUnit Plug-in Test
Precondition: Both JDT and PDE needs to be installed and activated.
- Open the Eclipse Launch Configuration Dialog in Run mode (Run -> Run...).
- Expand the "JUnit Plug-in test" category if not expanded anyway.
- Select the pre-configured launch configuration named "RSE Combined Test Suite".
- Choose "Duplicate" either from the context menu or from the tree toolbar.
- Change the launch configuration name of the duplicate to identify your test suites launch configuration.
- If your test suite is in another project than "org.eclipse.rse.tests", click now on the "Browse..." right after the "Project" entry field and select the project which contains your test suite.
- Click on the "Select..." button right after the "Test class" and choose your test suite or test case to run.
- Switch to the "Main" tab and check all settings to be as you want them. Usely you can leave them with their defaults.
- Switch to the "Arguments" tab and check all settings to be as you want them. Usely you can leave them with their defaults.
- Switch to the "Environment" tab if you require to set a specific environment to enable your test suite to run.
- Switch to the "Common" tab and change the "Save as" setting to "Local file".
- Click on the "Run" button to execute the launch configuration.
The JUnit view will open, near to the Problems view, to show the progress, successes and failures in executing the single test cases. Inspect the failures within the failure trace part for analysing why a test case might have failed. You have real great navigation possibilities and comparisation support from there.
In case that the JUnit view is not opened automatically, you can open the view via Window -> Show View -> Other ... -> Java -> JUnit.
Launching the DSDP-TM JUnit tests from within the currently running Eclipse instance
Precondition: The plugin org.eclipse.rse.tests.framework must be installed and activated.
- Switch to the "Remote System Explorer" perspective.
- Open the "Test Suites" view via Window -> Show View -> Other ... -> RSE Testing -> Test Suites.
- Select your test suite (or all test suites if you want to run them all) and choose "Run" from the context menu.
Progress and results of the single running test cases are presented in the result pane of the view. Copy the content of the result pane and send it to the contact how have asked you to run a specific test suite (or all) within your running Eclipse instance.
Please note that the "Test Suites" view executes the test suites by default in a random Eclipse worker thread. You may enforce the test suite execution to the SWT UI thread by unselecting the green button in the view toolbar. However this will not have any effect either way for test suites or test cases how require to run in worker threads to succeed. As these test suites or test cases can (and should) flag the desire to run in worker threads and the test framework can (and will) asure that this desire is fulfilled on runtime, the green button may not show an noticable effect.
If you are using this way to launch the test cases for RSE development, you must carefully indentify the output part belonging to the failed test case and copy the failure stack trace from there to you RSE development environments Java Stack Trace Console. As you loose any comfort of easy navigation and result comparisation this way, for RSE developers it is gently advised to follow section 2.1.