FAST - Fully Automated Search and Test, an Eclipse plug-in

Please let me know what you think about it at monika.krug.2007 (at) arcor (dot) de.

What FAST does

Test-Driven Development? Test-Driven Reuse! Instead of writing the class to make your JUnit test pass from scratch, find one on the internet. is a software search engine that crawls the web and public CVS and SVN repositories. It allows to specify method signature and thus whole interfaces of classes as search queries and is therefore perfect as a basis for test-driven reuse. This plug-in will parse your JUnit test case and create the query, send it to Merobase and download and compile the results for you automatically. It will then run the JUnit test you wrote on each of them to find out which of the classes Merobase found only happen to fit syntactically and which ones really do what you want them to do.

How to install

In Eclipse click on Help > Software Updates > Find and Install > select "... new features ..." > click on "New Remote Site..." and enter

How to use

The FAST plug-in is really easy and obvious to use from the context menu of any JUnit test case in the package explorer, but I will explain the steps in detail for those of you who want to know exactly what it does before installing it.

Write your JUnit test case, let's say StackTest for an integer stack (for the sake of simplicity, not because you would want to write a Stack frequently). Now, before you start writing the Stack, wait a second. Instead of starting to code, right-click on the StackTest class (or any class named * in the package explorer and choose the "Fully Automated Search and Test" submenu. There are five options, numbered 1 to 5. Each option includes all of the lower options.

  1. You can choose "1 Select this testcase for searching Merobase". A view comes up and you can specify the name of the class you were about to develop. (The JUnit parser needs to know which class that is.) The plug-in will guess that when you name the JUnit test "StackTest" that the class you were about to develop must be named "Stack".

  2. Then click the "Parse the test case to create a query" button. If you know you won't need to change the name of the tested class, you can instead immediately select the option "2 Parse this testcase and create the query for Merobase" from the submenu. In either case, the query will be determined from your JUnit test case and the name of the tested class and be shown in a text field in the view. Queries look like this:


    Modify the query if needed, e.g. if the plug-in did not recognize a parameter or return type correctly.

    A reason the plug-in might make a mistake is if e.g. there was first a method call push("abc"). and later a method call push(new Object()). The plug-in does not know about the class hierarchy, i.e. that String is a subtype of Object and therefore the method parameter type must be Object. It will create two methods, one "void push(String)" and one "void push(Object)". You can avoid this by adding an unnecessary cast, i.e. push((Object)"abc"), in your test case, or simply delete the extra method from the query.

  3. Now press the "Send the query to Merobase" button. If you are fairly confident that the plug-in will be able to determine the method signatures correctly, you can instead select the "3 Parse this testcase and send the query to Merobase" option right away. The results will be shown in a table in the view. You can now select or unselect some of the classes that were found to be fitting the interface of the class you were going to develop. Then select a prefix for the names of the test projects (one will be created for each downloaded class) or leave it as StackTestProject.

  4. Then click on "Download and compile the selected classes - create project for each". If you know from the beginning you will want to download all classes that Merobase finds and you won't want to change the prefix, you can instead click on "4 Parse testcase, send query and download the classes found" in the submenu in the beginning. Now the classes are being downloaded. The plug-in can however only obtain the classes from http:// URLs so far, not from cvs:// or svn:// URLs yet. A project is created for each, named StackTestProject01, StackTestProject02 and so on. The JUnit test case will be copied into each of it. Package changes will be made if necessary and an adapter class will be created if the names of the classes do not match.

  5. Afterwards you may want to inspect the downloaded classes (some of the compile problems may be easy to fix). You can run the test cases individually or you can select the "Run the test case on the selected classes" button and have the test applied automatically. Alternatively you could have selected "5 Parse testcase, send query, download classes and run the test" to run all five steps right away. If any test project won't compile without error, e.g. because it relies on classes in jars or on the website from which it was downloaded or simply because it's broken, the project will be deleted from the workspace as well as from the result table in the view. Also, the projects that fail the tests will be deleted from the workspace and from the table so you are only left with the successful candidates.

If your JUnit test case covered a sufficient number of possible input and output values, you can be confident that the remaining downloaded classes do what the class you were going to code was meant to do.


The source code is available inside the plug-in jar file. It is published under the CPL 1.0, the Common Public Licence.


"Test-Driven Reuse" is also known as "Extreme Harvesting".