You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Jörn Kottmann <ko...@gmail.com> on 2011/02/08 12:38:32 UTC

Add method to create a CAS to AnnotatorTester

Hi all,

I am writing a unit test for an Analysis Engine which does XML parsing.
The AE should get xml as binary content as input and then produce
a text view in my CAS.
In order to put the xml in the CAS I am using CAS.setSofaDataArray.

Now I want to make a test where I am preparing a CAS with the xml
and then check if the text view and metadata is created as expected.

For this test a method on the AnnotatorTest like performTest(String, String)
would be handy. Or just a method to create a CAS with the TypeSystem the
AE has.

I suggest to add this method AnnotatorTest.createCAS() which creates
a CAS that can be used for testing.

Jörn

Re: Add method to create a CAS to AnnotatorTester

Posted by Jörn Kottmann <ko...@gmail.com>.
On 2/8/11 5:16 PM, Marshall Schor wrote:
>
> On 2/8/2011 7:35 AM, Jörn Kottmann wrote:
>> On 2/8/11 1:22 PM, Marshall Schor wrote:
>>> Although I probably don't understand all the issues, I think it's fine to add
>>> methods to AnnotatorTester (I don't see AnnotatorTest ?) if they serve a new use
>>> case.
>> I use AnnotatorTester to create my AE. AnnotatorTester now encapsulates
>> the AE and does not allow me to call AnalysisEngine.newCAS(). But I need a
>> CAS instance in my test.
> go for it :-)  -Marshall
>
Already done:
https://issues.apache.org/jira/browse/UIMA-2037

Jörn

Re: Add method to create a CAS to AnnotatorTester

Posted by Marshall Schor <ms...@schor.com>.

On 2/8/2011 7:35 AM, Jörn Kottmann wrote:
> On 2/8/11 1:22 PM, Marshall Schor wrote:
>> Although I probably don't understand all the issues, I think it's fine to add
>> methods to AnnotatorTester (I don't see AnnotatorTest ?) if they serve a new use
>> case.
>
> I use AnnotatorTester to create my AE. AnnotatorTester now encapsulates
> the AE and does not allow me to call AnalysisEngine.newCAS(). But I need a
> CAS instance in my test.

go for it :-)  -Marshall
>
> Jörn
>
>

Re: Add method to create a CAS to AnnotatorTester

Posted by Jörn Kottmann <ko...@gmail.com>.
On 2/8/11 1:22 PM, Marshall Schor wrote:
> Although I probably don't understand all the issues, I think it's fine to add
> methods to AnnotatorTester (I don't see AnnotatorTest ?) if they serve a new use
> case.

I use AnnotatorTester to create my AE. AnnotatorTester now encapsulates
the AE and does not allow me to call AnalysisEngine.newCAS(). But I need a
CAS instance in my test.

Jörn

Re: Add method to create a CAS to AnnotatorTester

Posted by Marshall Schor <ms...@schor.com>.

On 2/8/2011 6:38 AM, Jörn Kottmann wrote:
> Hi all,
>
> I am writing a unit test for an Analysis Engine which does XML parsing.
> The AE should get xml as binary content as input and then produce
> a text view in my CAS.
> In order to put the xml in the CAS I am using CAS.setSofaDataArray.
>
> Now I want to make a test where I am preparing a CAS with the xml
> and then check if the text view and metadata is created as expected.
>
> For this test a method on the AnnotatorTest like performTest(String, String)
> would be handy. Or just a method to create a CAS with the TypeSystem the
> AE has.
>
> I suggest to add this method AnnotatorTest.createCAS() which creates
> a CAS that can be used for testing.

Although I probably don't understand all the issues, I think it's fine to add
methods to AnnotatorTester (I don't see AnnotatorTest ?) if they serve a new use
case. 

-Marshall
>
> Jörn
>
>