Downloading and setting up the testaco plugin

Downloading the testaco plugin is covered in the download page.

In addition, a number of things needs to be configured correctly for testaco to work as intended. One of these things is that Eclipse needs to be set up to expect Java 5 syntax. I suggest that this is done at the workspace level - it usually isn't a good idea to try to mix java versions within a workspace because of the possibility of being confused about which version is used when the going gets tough.

Setting up the workspace to expect Java 5 syntax is done by selecting "Preferences" from the "Window" menu. This will bring up the properties for the workspace. The compiler compliance setting can be found under "Java" and "Compiler", illustrated in the following image. Please ensure that this is set to "5.0", like in the image.

Annotation processing also needs to be switched on. This is done by selecting "Properties" from the "Project" menu in Eclipse. In the "Java compiler" -> "Annotation processing" group, check both "Enable project specific settings" and "Enable annotation processing". This will enable annotation processing for the currently selected project.

The next step is ensuring that the annotation processor within the testaco plugin is enabled. This is done in the same properties view, under the "Java compiler" -> "Annotation processing" -> "Factory path" group. Ensure that the testaco annotation processing factory is checked as in the below figure.

Following these steps will enable testaco to "see" all the DbLoad and DbCheck annotations, and figure out which databases and test data sets are involved. This is necessary in order for testaco to be able to refactor all data sets that are in use.

Warning - buggy code!

The annotation processor in version 0.5.0 of testaco is far too simplistic. It is not able to keep track of annotations that are removed, and the internal data structures used by the annotation processor is not stored when you restart Eclipse.

Until this is fixed, the workaround is to always do a full compile before every test run if any code has changed or if you have restarted eclipse. This is obviously a major bug, and very high up on the todo list.

Getting hold of the testaco view

Testaco places most of its information in a view that is separate from the junit results. This view can be found by selecting "Window" -> "Show view" -> "Other". The view can be found under the "Database refactoring" group, and is called "Failed database comparisons".

An example of how this view can look is shown below after a small testcase has run. In this testcase, two out of three tests failed, both because there was something wrong with the database contents after the test finished. Since both were database-related failures, both are shown in the view provided by testaco. Clicking on a row in this view will trigger the functionality within testaco

There are currently three kinds of functionality provided. If the error is related to an inconsistency in the database schema installed versus the stored reference version of the schema, a number of refactorings (adding and removing tables and columns) are provided, depending on the error. These refactorings will rewrite all data sets referenced by the tests.

If the error is related to the contents of the database, clicking the error in the report view will open a comparator window containing the database contents when the test finished and the reference data set. The comparator window allows visual inspection of any differences - and merging the changes into the reference data set, if needed.

The last piece of functionality provided is the ability to dump the current contents of a database defined in a project into a file. This behaviour is located in the toolbar of the testaco view, and is represented by a yellow database symbol.