uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: proposal for UIMA unit test utility code
Date Thu, 05 Feb 2009 21:02:00 GMT
Hi Philip,

The UIMA Test cases do some of this, but you may have things which
advance beyond what was done there.  A good way to see is to look in our
SVN at the tests.  A good one to look at is

We frequently use two kinds of setup - one involves creating a resource
which is the Analysis Engine XML descriptor, and reading it, and the
other which programmatically builds this.

An example of the first from that above test is:

      XMLInputSource in = new XMLInputSource(JUnitExtension
      AnalysisEngineDescription desc =
      AggregateAnalysisEngine_impl ae = new AggregateAnalysisEngine_impl();

An example of programmically constructing one:

      AnalysisEngineDescription primitiveDesc = new
      primitiveDesc.getMetaData().setName("Test Primitive TAE");
      Capability cap = new Capability_impl();
      cap.addOutputType("NamedEntity", true);
      cap.addOutputType("DocumentStructure", true);
      Capability[] caps = new Capability[] {cap};
      AnalysisEngine ae =

As you can see, these are somewhat verbose... 

We also have some utilities in uimaj-test-util; perhaps that might be a
good spot to add to.


Philip Ogren wrote:
> We have assembled some misc. utility methods that make unit testing
> easier to support our UIMA-based project ClearTK.  I have come across
> several scenarios now where I wish that this code was available as a
> separate project so that I don't have to create a dependency on our
> entire ClearTK project when I only need a few utility classes for
> writing unit tests.  So, I am thinking about spinning off a separate
> project that just has this unit-test specific code in it.  There
> really isn't that much code there (I think it's all shoved into one
> class at the moment) and would really be just a seed for getting
> something started.
> One thing the code does is simplify initialization of UIMA components
> programmatically such that you don't have to use descriptor files in
> your unit tests.  A unit test might start with something like:
> AnalysisEngine engine = TestsUtil.getAnalysisEngine(MyAnnotator.class,
> TestsUtil.getTypeSystem(Document.class, Token.class, Sentence.class));
> JCas jCas = engine.newJCas();
> and then you can go about populating the JCas and testing its contents.
> The current code is located here:
> http://code.google.com/p/cleartk/source/browse/trunk/test/src/org/cleartk/util/TestsUtil.java
> Some example unit tests based on this code can be found here:
> http://code.google.com/p/cleartk/source/browse/trunk/test/src/org/cleartk/example/ExamplePOSHandlerTests.java
> Is this something that is of interest?  Is there already code in UIMA
> that helps with this sort of thing?
> Thanks,
> Philip

View raw message