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 <[email protected]>
> To: POI Users List <[email protected]>
> 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 <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]