Mathieu has posted 10 posts at DZone. View Full User Profile

New API for Mycila Testing Framework

05.11.2009
| 1272 views |
  • submit to reddit
Location: 
http://code.mycila.com/

 Mycila Testing Framework aims at being a community framework where anyone could contribute their plugins to make unit testing easier.

 Basically, when you need to unit test you often need to create mocks, use memory databases, interact with spring, guice, ... This framework extends TestNG and Junit abilities to add support for plugins which make all the job for you. Plugins can enhance your tests (i.e. inject mocks, beans, ...) and are called at each step of the test:

  • During the test preparation 
  • Before a test method is called
  • After a test method is called
  • After all test methods have been called

 To use a plugin, you only need to put a Maven dependency in your pom.xml file. I.e, if you want to use JMock and Spring, you only need to add two modules for Spring and JMock.

 Writing new plugins is so easy thanks to a well-designed plugin API and introspection mechanism which let you recover fields, methods, or enything else from the test instance. Your plugins are also able to modify the behavior of the test framework: you can decide to skip some test methods, you can check if a method failed and thrown an exception to react upon.

 9 plugins have already been written for the most use cases, and you can find some new implementation ideas here. Also, with new and existing JDK features, you are able on JDK 6 to develop plugins instrumenting bytecode at runtime by dynamically loading a java agent without requiring vm parameters at startup.

 This project is open to everyone and contributions, patches, are greatly appreciated. Maven dependencies are also automatically made available in the Maven Central repository so that you can use new controbutions as soon as possible.

Mathieu.

0
Average: 5 (1 vote)
Published at DZone with permission of its author, Mathieu Carbou.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)