You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Jon Svede <js...@yahoo.com> on 2011/01/01 00:07:26 UTC

Re: Java Excel testing framework

Yes, I wrote the task last night.  I have the skeleton written, here is what it 
looks like right now:

I changed the name to ExcelAnt....

    <target name="test">
        <excelant fileName="${xls.file.root}/JDSTestCase.xls" 
outputFileName="outfile">
            <test name="testName">
                <set cell="sheet1!a1" value="1.0"/>
                <evaluate cell="sheet1!a2" expectedValue="1.0" 
precision="1.0e-1"/>
            </test>
            <test name="testName1">
                <set cell="sheet1!a1" value="1.0"/>
                <evaluate cell="sheet1!a2" expectedValue="1.0" 
precision="1.0e-1"/>
            </test>
        </excelant>
    </target>

I have to work on integrating the actual POI pieces now, but the task and the 
sub elements all can be invoked from an ant script.  


I had written something else that was like what Mark suggested, something XML 
based.  But it wasn't this clear and it didn't do the the test part.  It 
basically just did the updates and evaluated the outputs without any ability to 
"test".  


This to me seems cleaner, easier to write and maintain and integrate into a 
build process.  Plus, this lets the author write a test in whatever way they 
need to.  For example, I have spreadsheets were each sheet is basically a unit 
but I have others where you have to treat the whole workbook as a unit.  This 
doesn't constrain anyone that way.  The tests I'll need will be different, but I 
think this helps me. 


Does this help anyone else?  I'd be happy to share this if it does.

Jon






________________________________
From: Neil Benn <ne...@gmail.com>
To: POI Users List <us...@poi.apache.org>
Sent: Fri, December 31, 2010 3:35:15 AM
Subject: Re: Java Excel testing framework

You could make an ant task to do what you need?

On Fri, Dec 31, 2010 at 12:49 AM, Jon Svede <js...@yahoo.com> wrote:
> Is there test framework that uses POI that allows someone to write tests?  I
> need to write a lot of tests for some spreadsheets we have and I don't really
> want to write it in Java because it means only I can update them.  I was
> thinking of something that let me write JUnit tests in Ant.  If that isn't
> clear, here is what I am imagining:
>
> <!-- there's a lot missing here but I didn't want to distract myself -->
>
> <project name="foo">
>
> <path id="poi.classpath">
>  <fileset dir="${poi.lib}">
>    <include name="**/*.jar"/>
>  </fileset>
> </path>
>
>
> <punit file="/path/to/some.xls" classpathref="poi.classpath"> <!-- for lack of 
>a
> better name -->
>    <punittest name="anArbitraryTestName">
>        <set cell="sheet1!a1" value="1.0"/>
>        <set cell="sheet1!b1" value="2.0"/>
>        <evaluate cell="sheet1!c1" expected-value="3.0" precision="1.0e-1"/>
>    </punittest>
> </punit>
>
> </project>
>
>
> So basically in my imaginary framework I can test a spreadsheet by setting
> values into cells and the evaluating cells that are formulas and verify the
> result.
>
> This would allow me to quickly write repeatable tests that produce JUnit-like
> output.  Maybe the framework would allow output to be written to a file? 
Dunno,
> I am just making stuff up.
>
> Does anything like this exist?  Or am I off in the weeds here.
>
> Thanks,
>
> Jon
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


      

Re: Java Excel testing framework

Posted by Jon Svede <js...@yahoo.com>.
I've created bugzilla #50610 with a patch and source files attached.  Please let 
me know how to proceed on the build as well where I should add the example ant 
build files.

Looking forward to your feedback!

Sincerely,

Jon






________________________________
From: Nick Burch <ni...@alfresco.com>
To: POI Developers List <de...@poi.apache.org>
Sent: Wed, January 12, 2011 8:03:56 AM
Subject: Re: Java Excel testing framework

On Wed, 12 Jan 2011, Jon Svede wrote:
> When you say " You'd need to add a few more entries to build.xml to have it 
>compiled and the jar generated..." do you mean a separate jar generated or for 
>these classes to be included in the POI jar?

I think it probably wants to be its own jar

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


      

Re: Java Excel testing framework

Posted by Nick Burch <ni...@alfresco.com>.
On Wed, 12 Jan 2011, Jon Svede wrote:
> When you say " You'd need to add a few more entries to build.xml to have 
> it compiled and the jar generated..." do you mean a separate jar 
> generated or for these classes to be included in the POI jar?

I think it probably wants to be its own jar

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: Java Excel testing framework

Posted by Jon Svede <js...@yahoo.com>.
Thanks, Nick.

I will make the naming changes and then integrate it as you suggest.

When you say " You'd need to add a few more entries to build.xml to have it 
compiled  and the jar generated..." do you mean a separate jar generated or for 
these classes to be included in the POI jar?  


Sincerely,

Jon





________________________________
From: Nick Burch <ni...@alfresco.com>
To: POI Developers List <de...@poi.apache.org>
Sent: Mon, January 10, 2011 9:05:02 AM
Subject: Re: Java Excel testing framework

On Sun, 2 Jan 2011, Jon Svede wrote:
> I have what I would consider a first version of ExcelAnt up and running in my 
>environment.  If someone could give me a clue about what things I need to 
>consider before submitting it via bugzilla (as mentioned below, package names, 
>build files, etc), I'd be happy to make the necessary tweaks and then create the 
>ticket.  I am expecting that there will be some revisions/additions before it's 
>ready for prime time, but I have it working in my env.

My hunch is that it'll want to be in its own area in the source tree, since 
it'll have extra dependencies compared to the other code. Do others agree?

Assuming so, the package name could probably be something like 
org.apache.poi.ss.ant . The code would say go under /src/ant/src/ + 
/src/ant/testcases/ . You'd need to add a few more entries to build.xml to have 
it compiled and the jar generated, but I'm happy to help with that if needed

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


      

Re: Java Excel testing framework

Posted by Nick Burch <ni...@alfresco.com>.
On Sun, 2 Jan 2011, Jon Svede wrote:
> I have what I would consider a first version of ExcelAnt up and running 
> in my environment.  If someone could give me a clue about what things I 
> need to consider before submitting it via bugzilla (as mentioned below, 
> package names, build files, etc), I'd be happy to make the necessary 
> tweaks and then create the ticket.  I am expecting that there will be 
> some revisions/additions before it's ready for prime time, but I have it 
> working in my env.

My hunch is that it'll want to be in its own area in the source tree, 
since it'll have extra dependencies compared to the other code. Do others 
agree?

Assuming so, the package name could probably be something like 
org.apache.poi.ss.ant . The code would say go under /src/ant/src/ + 
/src/ant/testcases/ . You'd need to add a few more entries to build.xml to 
have it compiled and the jar generated, but I'm happy to help with that if 
needed

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: Java Excel testing framework

Posted by Jon Svede <js...@yahoo.com>.
Hi All,

I have what I would consider a first version of ExcelAnt up and running in my 
environment.  If someone could give me a clue about what things I need to 
consider before submitting it via bugzilla (as mentioned below, package names, 
build files, etc), I'd be happy to make the necessary tweaks and then create the 
ticket.  I am expecting that there will be some revisions/additions before it's 
ready for prime time, but I have it working in my env.

As mentioned below, I added support for the user defined functions that let you 
write code to replace VB macros.

Please feel free to provide me feedback directly about it as it is or about 
suggestions for future enhancements.

Jon





________________________________
From: Jon Svede <js...@yahoo.com>
To: POI Developers List <de...@poi.apache.org>
Sent: Fri, December 31, 2010 9:25:21 PM
Subject: Re: Java Excel testing framework

Dave,

It would be a pleasure to make a contribution to POI!  The Apache Foundation has 

made my life as a developer much easier and it would be rewarding to make a 
contribution (small though it may be).

Let me work it forward a little more and then I will create the ticket.  Do I 
need to do anything special in consideration of contributing it? (package names, 

build structures, etc).

I want to add support for externally defining user defined functions (because I 
need that and I imagine others will as well). I was concerned about the POI 
version thing (i.e., what version of ExcelAnt supports which version of POI), 
but if I contribute it, that won't be an issue. :-)

Happy New Year!

Jon





________________________________
From: David Fisher <df...@jmlafferty.com>
To: POI Users List <us...@poi.apache.org>
Cc: POI Developers List <de...@poi.apache.org>
Sent: Fri, December 31, 2010 4:54:56 PM
Subject: Re: Java Excel testing framework

Jon,

Yes, please share it.

An ant task like this would fit in well with our apps testing framework.

I think it would make an ExcelAnt contribution to Apache POI. If you think so, 
then you could open up a bugzilla and attach.

Sounds exciting.

Happy New Year,
Dave


On Dec 31, 2010, at 3:07 PM, Jon Svede wrote:

> Yes, I wrote the task last night.  I have the skeleton written, here is what it 
>
>
> looks like right now:
> 
> I changed the name to ExcelAnt....
> 
>    <target name="test">
>        <excelant fileName="${xls.file.root}/JDSTestCase.xls" 
> outputFileName="outfile">
>            <test name="testName">
>                <set cell="sheet1!a1" value="1.0"/>
>                <evaluate cell="sheet1!a2" expectedValue="1.0" 
> precision="1.0e-1"/>
>            </test>
>            <test name="testName1">
>                <set cell="sheet1!a1" value="1.0"/>
>                <evaluate cell="sheet1!a2" expectedValue="1.0" 
> precision="1.0e-1"/>
>            </test>
>        </excelant>
>    </target>
> 
> I have to work on integrating the actual POI pieces now, but the task and the 
> sub elements all can be invoked from an ant script.  
> 
> 
> I had written something else that was like what Mark suggested, something XML 
> based.  But it wasn't this clear and it didn't do the the test part.  It 
> basically just did the updates and evaluated the outputs without any ability to 
>
>
> "test".  
> 
> 
> This to me seems cleaner, easier to write and maintain and integrate into a 
> build process.  Plus, this lets the author write a test in whatever way they 
> need to.  For example, I have spreadsheets were each sheet is basically a unit 


> but I have others where you have to treat the whole workbook as a unit.  This 
> doesn't constrain anyone that way.  The tests I'll need will be different, but 

>I 
>
> think this helps me. 
> 
> 
> Does this help anyone else?  I'd be happy to share this if it does.
> 
> Jon
> 
> 
> 
> 
> 
> 
> ________________________________
> From: Neil Benn <ne...@gmail.com>
> To: POI Users List <us...@poi.apache.org>
> Sent: Fri, December 31, 2010 3:35:15 AM
> Subject: Re: Java Excel testing framework
> 
> You could make an ant task to do what you need?
> 
> On Fri, Dec 31, 2010 at 12:49 AM, Jon Svede <js...@yahoo.com> wrote:
>> Is there test framework that uses POI that allows someone to write tests?  I
>> need to write a lot of tests for some spreadsheets we have and I don't really
>> want to write it in Java because it means only I can update them.  I was
>> thinking of something that let me write JUnit tests in Ant.  If that isn't
>> clear, here is what I am imagining:
>> 
>> <!-- there's a lot missing here but I didn't want to distract myself -->
>> 
>> <project name="foo">
>> 
>> <path id="poi.classpath">
>> <fileset dir="${poi.lib}">
>>   <include name="**/*.jar"/>
>> </fileset>
>> </path>
>> 
>> 
>> <punit file="/path/to/some.xls" classpathref="poi.classpath"> <!-- for lack of 
>
>
>> a
>> better name -->
>>   <punittest name="anArbitraryTestName">
>>       <set cell="sheet1!a1" value="1.0"/>
>>       <set cell="sheet1!b1" value="2.0"/>
>>       <evaluate cell="sheet1!c1" expected-value="3.0" precision="1.0e-1"/>
>>   </punittest>
>> </punit>
>> 
>> </project>
>> 
>> 
>> So basically in my imaginary framework I can test a spreadsheet by setting
>> values into cells and the evaluating cells that are formulas and verify the
>> result.
>> 
>> This would allow me to quickly write repeatable tests that produce JUnit-like
>> output.  Maybe the framework would allow output to be written to a file? 
> Dunno,
>> I am just making stuff up.
>> 
>> Does anything like this exist?  Or am I off in the weeds here.
>> 
>> Thanks,
>> 
>> Jon
>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


      

Re: Java Excel testing framework

Posted by Jon Svede <js...@yahoo.com>.
Dave,

It would be a pleasure to make a contribution to POI!  The Apache Foundation has 
made my life as a developer much easier and it would be rewarding to make a 
contribution (small though it may be).

Let me work it forward a little more and then I will create the ticket.  Do I 
need to do anything special in consideration of contributing it? (package names, 
build structures, etc).

I want to add support for externally defining user defined functions (because I 
need that and I imagine others will as well). I was concerned about the POI 
version thing (i.e., what version of ExcelAnt supports which version of POI), 
but if I contribute it, that won't be an issue. :-)

Happy New Year!

Jon





________________________________
From: David Fisher <df...@jmlafferty.com>
To: POI Users List <us...@poi.apache.org>
Cc: POI Developers List <de...@poi.apache.org>
Sent: Fri, December 31, 2010 4:54:56 PM
Subject: Re: Java Excel testing framework

Jon,

Yes, please share it.

An ant task like this would fit in well with our apps testing framework.

I think it would make an ExcelAnt contribution to Apache POI. If you think so, 
then you could open up a bugzilla and attach.

Sounds exciting.

Happy New Year,
Dave


On Dec 31, 2010, at 3:07 PM, Jon Svede wrote:

> Yes, I wrote the task last night.  I have the skeleton written, here is what it 
>
> looks like right now:
> 
> I changed the name to ExcelAnt....
> 
>    <target name="test">
>        <excelant fileName="${xls.file.root}/JDSTestCase.xls" 
> outputFileName="outfile">
>            <test name="testName">
>                <set cell="sheet1!a1" value="1.0"/>
>                <evaluate cell="sheet1!a2" expectedValue="1.0" 
> precision="1.0e-1"/>
>            </test>
>            <test name="testName1">
>                <set cell="sheet1!a1" value="1.0"/>
>                <evaluate cell="sheet1!a2" expectedValue="1.0" 
> precision="1.0e-1"/>
>            </test>
>        </excelant>
>    </target>
> 
> I have to work on integrating the actual POI pieces now, but the task and the 
> sub elements all can be invoked from an ant script.  
> 
> 
> I had written something else that was like what Mark suggested, something XML 
> based.  But it wasn't this clear and it didn't do the the test part.  It 
> basically just did the updates and evaluated the outputs without any ability to 
>
> "test".  
> 
> 
> This to me seems cleaner, easier to write and maintain and integrate into a 
> build process.  Plus, this lets the author write a test in whatever way they 
> need to.  For example, I have spreadsheets were each sheet is basically a unit 

> but I have others where you have to treat the whole workbook as a unit.  This 
> doesn't constrain anyone that way.  The tests I'll need will be different, but 
>I 
>
> think this helps me. 
> 
> 
> Does this help anyone else?  I'd be happy to share this if it does.
> 
> Jon
> 
> 
> 
> 
> 
> 
> ________________________________
> From: Neil Benn <ne...@gmail.com>
> To: POI Users List <us...@poi.apache.org>
> Sent: Fri, December 31, 2010 3:35:15 AM
> Subject: Re: Java Excel testing framework
> 
> You could make an ant task to do what you need?
> 
> On Fri, Dec 31, 2010 at 12:49 AM, Jon Svede <js...@yahoo.com> wrote:
>> Is there test framework that uses POI that allows someone to write tests?  I
>> need to write a lot of tests for some spreadsheets we have and I don't really
>> want to write it in Java because it means only I can update them.  I was
>> thinking of something that let me write JUnit tests in Ant.  If that isn't
>> clear, here is what I am imagining:
>> 
>> <!-- there's a lot missing here but I didn't want to distract myself -->
>> 
>> <project name="foo">
>> 
>> <path id="poi.classpath">
>> <fileset dir="${poi.lib}">
>>   <include name="**/*.jar"/>
>> </fileset>
>> </path>
>> 
>> 
>> <punit file="/path/to/some.xls" classpathref="poi.classpath"> <!-- for lack of 
>
>> a
>> better name -->
>>   <punittest name="anArbitraryTestName">
>>       <set cell="sheet1!a1" value="1.0"/>
>>       <set cell="sheet1!b1" value="2.0"/>
>>       <evaluate cell="sheet1!c1" expected-value="3.0" precision="1.0e-1"/>
>>   </punittest>
>> </punit>
>> 
>> </project>
>> 
>> 
>> So basically in my imaginary framework I can test a spreadsheet by setting
>> values into cells and the evaluating cells that are formulas and verify the
>> result.
>> 
>> This would allow me to quickly write repeatable tests that produce JUnit-like
>> output.  Maybe the framework would allow output to be written to a file? 
> Dunno,
>> I am just making stuff up.
>> 
>> Does anything like this exist?  Or am I off in the weeds here.
>> 
>> Thanks,
>> 
>> Jon
>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


      

Re: Java Excel testing framework

Posted by David Fisher <df...@jmlafferty.com>.
Jon,

Yes, please share it.

An ant task like this would fit in well with our apps testing framework.

I think it would make an ExcelAnt contribution to Apache POI. If you think so, then you could open up a bugzilla and attach.

Sounds exciting.

Happy New Year,
Dave


On Dec 31, 2010, at 3:07 PM, Jon Svede wrote:

> Yes, I wrote the task last night.  I have the skeleton written, here is what it 
> looks like right now:
> 
> I changed the name to ExcelAnt....
> 
>    <target name="test">
>        <excelant fileName="${xls.file.root}/JDSTestCase.xls" 
> outputFileName="outfile">
>            <test name="testName">
>                <set cell="sheet1!a1" value="1.0"/>
>                <evaluate cell="sheet1!a2" expectedValue="1.0" 
> precision="1.0e-1"/>
>            </test>
>            <test name="testName1">
>                <set cell="sheet1!a1" value="1.0"/>
>                <evaluate cell="sheet1!a2" expectedValue="1.0" 
> precision="1.0e-1"/>
>            </test>
>        </excelant>
>    </target>
> 
> I have to work on integrating the actual POI pieces now, but the task and the 
> sub elements all can be invoked from an ant script.  
> 
> 
> I had written something else that was like what Mark suggested, something XML 
> based.  But it wasn't this clear and it didn't do the the test part.  It 
> basically just did the updates and evaluated the outputs without any ability to 
> "test".  
> 
> 
> This to me seems cleaner, easier to write and maintain and integrate into a 
> build process.  Plus, this lets the author write a test in whatever way they 
> need to.  For example, I have spreadsheets were each sheet is basically a unit 
> but I have others where you have to treat the whole workbook as a unit.  This 
> doesn't constrain anyone that way.  The tests I'll need will be different, but I 
> think this helps me. 
> 
> 
> Does this help anyone else?  I'd be happy to share this if it does.
> 
> Jon
> 
> 
> 
> 
> 
> 
> ________________________________
> From: Neil Benn <ne...@gmail.com>
> To: POI Users List <us...@poi.apache.org>
> Sent: Fri, December 31, 2010 3:35:15 AM
> Subject: Re: Java Excel testing framework
> 
> You could make an ant task to do what you need?
> 
> On Fri, Dec 31, 2010 at 12:49 AM, Jon Svede <js...@yahoo.com> wrote:
>> Is there test framework that uses POI that allows someone to write tests?  I
>> need to write a lot of tests for some spreadsheets we have and I don't really
>> want to write it in Java because it means only I can update them.  I was
>> thinking of something that let me write JUnit tests in Ant.  If that isn't
>> clear, here is what I am imagining:
>> 
>> <!-- there's a lot missing here but I didn't want to distract myself -->
>> 
>> <project name="foo">
>> 
>> <path id="poi.classpath">
>> <fileset dir="${poi.lib}">
>>   <include name="**/*.jar"/>
>> </fileset>
>> </path>
>> 
>> 
>> <punit file="/path/to/some.xls" classpathref="poi.classpath"> <!-- for lack of 
>> a
>> better name -->
>>   <punittest name="anArbitraryTestName">
>>       <set cell="sheet1!a1" value="1.0"/>
>>       <set cell="sheet1!b1" value="2.0"/>
>>       <evaluate cell="sheet1!c1" expected-value="3.0" precision="1.0e-1"/>
>>   </punittest>
>> </punit>
>> 
>> </project>
>> 
>> 
>> So basically in my imaginary framework I can test a spreadsheet by setting
>> values into cells and the evaluating cells that are formulas and verify the
>> result.
>> 
>> This would allow me to quickly write repeatable tests that produce JUnit-like
>> output.  Maybe the framework would allow output to be written to a file? 
> Dunno,
>> I am just making stuff up.
>> 
>> Does anything like this exist?  Or am I off in the weeds here.
>> 
>> Thanks,
>> 
>> Jon
>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: Java Excel testing framework

Posted by Neil Benn <ne...@gmail.com>.
Hello,

        Looks great - I'd be interested too.

Cheers,

Neil

On Fri, Dec 31, 2010 at 11:07 PM, Jon Svede <js...@yahoo.com> wrote:
> Yes, I wrote the task last night.  I have the skeleton written, here is what it
> looks like right now:
>
> I changed the name to ExcelAnt....
>
>    <target name="test">
>        <excelant fileName="${xls.file.root}/JDSTestCase.xls"
> outputFileName="outfile">
>            <test name="testName">
>                <set cell="sheet1!a1" value="1.0"/>
>                <evaluate cell="sheet1!a2" expectedValue="1.0"
> precision="1.0e-1"/>
>            </test>
>            <test name="testName1">
>                <set cell="sheet1!a1" value="1.0"/>
>                <evaluate cell="sheet1!a2" expectedValue="1.0"
> precision="1.0e-1"/>
>            </test>
>        </excelant>
>    </target>
>
> I have to work on integrating the actual POI pieces now, but the task and the
> sub elements all can be invoked from an ant script.
>
>
> I had written something else that was like what Mark suggested, something XML
> based.  But it wasn't this clear and it didn't do the the test part.  It
> basically just did the updates and evaluated the outputs without any ability to
> "test".
>
>
> This to me seems cleaner, easier to write and maintain and integrate into a
> build process.  Plus, this lets the author write a test in whatever way they
> need to.  For example, I have spreadsheets were each sheet is basically a unit
> but I have others where you have to treat the whole workbook as a unit.  This
> doesn't constrain anyone that way.  The tests I'll need will be different, but I
> think this helps me.
>
>
> Does this help anyone else?  I'd be happy to share this if it does.
>
> Jon
>
>
>
>
>
>
> ________________________________
> From: Neil Benn <ne...@gmail.com>
> To: POI Users List <us...@poi.apache.org>
> Sent: Fri, December 31, 2010 3:35:15 AM
> Subject: Re: Java Excel testing framework
>
> You could make an ant task to do what you need?
>
> On Fri, Dec 31, 2010 at 12:49 AM, Jon Svede <js...@yahoo.com> wrote:
>> Is there test framework that uses POI that allows someone to write tests?  I
>> need to write a lot of tests for some spreadsheets we have and I don't really
>> want to write it in Java because it means only I can update them.  I was
>> thinking of something that let me write JUnit tests in Ant.  If that isn't
>> clear, here is what I am imagining:
>>
>> <!-- there's a lot missing here but I didn't want to distract myself -->
>>
>> <project name="foo">
>>
>> <path id="poi.classpath">
>>  <fileset dir="${poi.lib}">
>>    <include name="**/*.jar"/>
>>  </fileset>
>> </path>
>>
>>
>> <punit file="/path/to/some.xls" classpathref="poi.classpath"> <!-- for lack of
>>a
>> better name -->
>>    <punittest name="anArbitraryTestName">
>>        <set cell="sheet1!a1" value="1.0"/>
>>        <set cell="sheet1!b1" value="2.0"/>
>>        <evaluate cell="sheet1!c1" expected-value="3.0" precision="1.0e-1"/>
>>    </punittest>
>> </punit>
>>
>> </project>
>>
>>
>> So basically in my imaginary framework I can test a spreadsheet by setting
>> values into cells and the evaluating cells that are formulas and verify the
>> result.
>>
>> This would allow me to quickly write repeatable tests that produce JUnit-like
>> output.  Maybe the framework would allow output to be written to a file?
> Dunno,
>> I am just making stuff up.
>>
>> Does anything like this exist?  Or am I off in the weeds here.
>>
>> Thanks,
>>
>> Jon
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Java Excel testing framework

Posted by David Fisher <df...@jmlafferty.com>.
Jon,

Yes, please share it.

An ant task like this would fit in well with our apps testing framework.

I think it would make an ExcelAnt contribution to Apache POI. If you think so, then you could open up a bugzilla and attach.

Sounds exciting.

Happy New Year,
Dave


On Dec 31, 2010, at 3:07 PM, Jon Svede wrote:

> Yes, I wrote the task last night.  I have the skeleton written, here is what it 
> looks like right now:
> 
> I changed the name to ExcelAnt....
> 
>    <target name="test">
>        <excelant fileName="${xls.file.root}/JDSTestCase.xls" 
> outputFileName="outfile">
>            <test name="testName">
>                <set cell="sheet1!a1" value="1.0"/>
>                <evaluate cell="sheet1!a2" expectedValue="1.0" 
> precision="1.0e-1"/>
>            </test>
>            <test name="testName1">
>                <set cell="sheet1!a1" value="1.0"/>
>                <evaluate cell="sheet1!a2" expectedValue="1.0" 
> precision="1.0e-1"/>
>            </test>
>        </excelant>
>    </target>
> 
> I have to work on integrating the actual POI pieces now, but the task and the 
> sub elements all can be invoked from an ant script.  
> 
> 
> I had written something else that was like what Mark suggested, something XML 
> based.  But it wasn't this clear and it didn't do the the test part.  It 
> basically just did the updates and evaluated the outputs without any ability to 
> "test".  
> 
> 
> This to me seems cleaner, easier to write and maintain and integrate into a 
> build process.  Plus, this lets the author write a test in whatever way they 
> need to.  For example, I have spreadsheets were each sheet is basically a unit 
> but I have others where you have to treat the whole workbook as a unit.  This 
> doesn't constrain anyone that way.  The tests I'll need will be different, but I 
> think this helps me. 
> 
> 
> Does this help anyone else?  I'd be happy to share this if it does.
> 
> Jon
> 
> 
> 
> 
> 
> 
> ________________________________
> From: Neil Benn <ne...@gmail.com>
> To: POI Users List <us...@poi.apache.org>
> Sent: Fri, December 31, 2010 3:35:15 AM
> Subject: Re: Java Excel testing framework
> 
> You could make an ant task to do what you need?
> 
> On Fri, Dec 31, 2010 at 12:49 AM, Jon Svede <js...@yahoo.com> wrote:
>> Is there test framework that uses POI that allows someone to write tests?  I
>> need to write a lot of tests for some spreadsheets we have and I don't really
>> want to write it in Java because it means only I can update them.  I was
>> thinking of something that let me write JUnit tests in Ant.  If that isn't
>> clear, here is what I am imagining:
>> 
>> <!-- there's a lot missing here but I didn't want to distract myself -->
>> 
>> <project name="foo">
>> 
>> <path id="poi.classpath">
>> <fileset dir="${poi.lib}">
>>   <include name="**/*.jar"/>
>> </fileset>
>> </path>
>> 
>> 
>> <punit file="/path/to/some.xls" classpathref="poi.classpath"> <!-- for lack of 
>> a
>> better name -->
>>   <punittest name="anArbitraryTestName">
>>       <set cell="sheet1!a1" value="1.0"/>
>>       <set cell="sheet1!b1" value="2.0"/>
>>       <evaluate cell="sheet1!c1" expected-value="3.0" precision="1.0e-1"/>
>>   </punittest>
>> </punit>
>> 
>> </project>
>> 
>> 
>> So basically in my imaginary framework I can test a spreadsheet by setting
>> values into cells and the evaluating cells that are formulas and verify the
>> result.
>> 
>> This would allow me to quickly write repeatable tests that produce JUnit-like
>> output.  Maybe the framework would allow output to be written to a file? 
> Dunno,
>> I am just making stuff up.
>> 
>> Does anything like this exist?  Or am I off in the weeds here.
>> 
>> Thanks,
>> 
>> Jon
>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org