How to Run Tests

The Plugin can run any TestCase components that live in configured Eclipse projects. This is important: If the TestCase lives on your file system, but is not part of an Eclipse project, the plugin cannot run it as a test! This follows the expected Eclipse behavior: it has no notion of code living outside of projects.

You can run tests in three different ways in the plugin:

  1. Right click any project, directory, CFC, or multiple projects/directories/components. Select "Run MXUnit Tests". This will load the tests and run them.
  2. With an open CFC, right click in the Editor window and select "Run MXUnit Test". This will load the test and run it.
  3. From the MXUnit view, click the "flashlight" icon (or use keyboard shortcut CTRL-F). This pops up the resource finder. You can then type any directory or component name and it'll filter down to find what you're looking for. Click "OK" and your component(s) will load in the view. They will NOT run. You can run them by hitting Enter or clicking the green Play icon in the view.

In addition, once a test is run, it is added to the Test History. You can access the test history by clicking the History icon () dropdown and selecting a previously run Suite. This will load the tests into the view but will not automatically run them.

Reloading/Refreshing Tests

Once a Test is run, it retains certain data. Re-running a test overwrites its data with the new test results. Sometimes, you want to clear the data without actually running the test. To do so, simply click the "Reload" icon () or hit F5.

This is mostly useful when you've run a test case component, then you add, remove, or rename test functions. Rather than right-clicking the file in the navigator view and running it again, you can just Reload the test from the view. This will load in the or renamed methods and remove the deleted methods. You can now pick which methods you want to run.

How does the plugin know what components are tests?

Currently, the plugin (and the framework) recognize a test as any file named Test*.cfc or *Test.cfc.

A TestCase Not a TestCase
SomeTest.cfc SomeTest.cfm
SomeTest.cfc SomeTests.cfc
TestThisThing.cfc ThisThing.cfc
sometest.cfc TestYouGetThePicture.html

TestCase selection is not case sensitive.

Inside of a TestCase component -- specified as a component that extends mxunit.framework.TestCase -- the MXUnit framework will run any public method as a test, regardless of its name! The framework will NOT run protected or private methods as tests.

Next: Running the Demo Tests