Over a million developers have joined DZone.

New API for Mycila Testing Framework

DZone's Guide to

New API for Mycila Testing Framework

· ·
Free Resource

 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.



Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}