Eclipse Plug-in

The MagicTest functionality is accessible through the normal Java IDE and by the HTML reports created by MagicTest.

Java IDE

Menus

An entry named "MagicTest" is added to the context menu of the Java editor, the editor outline and the package and project explorer. It offers the following commands:

  • Run test: Run the selected test (identical to execute the Run As / MagicTest Test command)

  • Save test: Save actual output as reference output (identical to clicking on the Save link in the HTML report)

  • Show test: Opens the test method for a method if it exists. The test method is searched based on the used standard naming conventions.

  • Show actual test report: Open the HTML report showing the actual test report

  • Show reference test report: Open the HTML report showing the reference test report

The possibility to run test has also been integrated in the standard Eclipse Run As menu:

  • Use the command "Run As / MagicTest Test" or the "Run test" entry from the MagicTest context menu to run a test.

  • You can also use "Debug As / MagicTest Test" to run tests with the debugger.

Depending on your selection, you can use this command to run a single test method, all test methods of a class or even all test methods of a whole package.

During the test is run, you will see the output written by the test method and some informational output on the Eclipse console.

After the test has been run, a view will show which tests have been successful and which failed.

If a test has failed during the test run, its HTML report will automatically be opened in an Eclipse browser.

Toolbar

An action icon showing the MagicTest icon is added to the Eclipse toolbar. It allows to switch from test class to class under test and vice versa with a single click. Note that this not only works for tests created with MagicTest, but also for JUnit or TestNG tests as long as they adhere to the naming conventions.

HTML Report

The HTML report does not only show the state of the last test run, but integrates also the most important commands as hyperlinks directly in the HTML page.

At top of the report is a contents section giving an overview over the status of all tests of this class. It also offers the following commands:

  • If you click on the "Run" link, the test is run again.

  • If the test has failed, you can save the actual output as reference output by clicking on the "Save" link. The test will then be considered as successful.

  • Click on the "Show source" link to open the editor showing the Java source code.

  • If you have erroneously saved a test result, you can click on "Invalidate" to delete the reference output. The test will then be considered as failed again.

  • There may also be a link "Delete" if a test is marked as "Missing". This means that this test still exists in the reference output, but no such test has been found during the last run. If you click on "Delete", the test is removed from the reference output.

These commands are also available on method and class level.

For navigation, you can click on a test's name to jump to the details of the test. If the test is has status "Error", you can click on the text "Error" to jump directly to first erroneous step of the test.

In front of each test method, you will find arrow links for navigating: they bring to easily to the top of the report or to the previous or next test.

Clicking in the "Step" column will jump to the top of the test.

Uninstall

To uninstall MagicTest, you remove the magictest-eclipse.jar from the dropins folder and restart Eclipse.

Command Line

MagicTest provides two command line applications:

  • magictest.jar: contains the MagicTest core functionality with a simple own test runner

  • magictest-ng.jar: contains an integration of MagicTest with TestNG and uses its test runner

Command Line magictest.jar

If you are using magictest.jar, the following arguments are available on the command line:

  • [-run|-save|-invalidate|-delete] [-log <level>] [-dir <dir>] [-method {method} | -class {class} | -package {package}]

Example:

set MAGICTEST_CP=magictest.jar
set MAGICTEST_MAIN=org.magictest.MagicTest
set TESTS_CP=bin

java -cp %MAGICTEST_CP%;%TESTS_CP% %MAGICTEST_MAIN% -class mypkg.myclass

Command Line Client magictest-ng.jar

If you are using magictest-ng.jar, you can use all arguments you would use with TestNG.

Example:

set MAGICTEST_CP=magictest-ng.jar
set MAGICTEST_MAIN=org.magictest.ng.MagicTestNG
set TESTS_CP=bin

java -cp %MAGICTEST_CP%;%TESTS_CP% %MAGICTEST_MAIN% testng.xml

 
© Magicwerk.org