The simplest way to get started with MagicTest is to use the Eclipse plug-in with the provided example project:

  • Download the Eclipse plug-in from the download section of the MagicTest website.

  • Copy the file magictest-eclipse.jar file into the dropins folder of your Eclipse installation.

  • Restart Eclipse.

  • Download the MagicTest-Examples project contained in the magictest-examples.zip and import it into your workspace.

  • Run the tests with "Run As / MagicTest" from the default run menu or the command "Run test" from the MagicTest context menu.

  • Check the HTML report automatically shown after running the test.

Add MagicTest to an existing Eclipse project

The examples project is setup to include MagicTest in the classpath. If you want to use MagicTest in your own project, do the following:

  • Navigate to your test project, open the Java Build Path dialog and select the tab Libraries. Press "Add Library...", select MagicTest and press Finish.

Per default, MagicTest stores actual and reference output files in the directory named "magictest" located in the project's root folder. The reference files (*.ref.xml, *.ref.html) must be put under version control so MagicTest has access to the expected results together with the test source. To add the actual output files (*.act.xml, *.act.html) to version control is typically not a good idea, as they change with each test run. So it is probably the best idea to make your version control ignore them by using some sort of wilcard pattern.

It can also be necessary to change the location of the "magictest" folder, e.g. if you are using the Maven project structure the folder should be put at "src/test/resources/magictest". Do the following to change the location:

  • Navigate to your test project, open the Properties dialog, select the MagicTest entry and set the "MagicTest directory" to "src/test/resources/magictest".

Run MagicTest with Ant or Maven

MagicTest can be integrated

© Magicwerk.org