Hi,
I'm trying to write some unit tests of instrument. As discussed,
I'm using exec.
Currently I've tried Support_Exec and find it fairly easy to
use(Thanks Stepan :) ).
For resources (jar files and utility classes), I make a new directory:
$Harmony/modules/instrument/src/test/resource/org/apache/harmony/tests/instrument
and put them there.
And I meet a problem here. Currently the default classpath in
running test is "$Harmony/modules/instrument/bin", so it meets problem
in loading those utility classes (it can load jar files though).
I remember Mark has plan to change the classpath in running
testcase, it'll be great if he make some progress.
An another problem is checking, currently the result is checked by
searching and compare in string(e.g, find "someException" in result).
But the framework seems fails if any exception is thrown out. Can it
make a little change that it passes and returns the error message in exec?
Jimmy, Jing Lv wrote:
Stepan Mishura wrote:
On 8/7/06, *Jimmy, Jing Lv* wrote:
<SNIP>
Sounds pretty good :)
"exec" do helps, it can check simple situations.
What I'm concern is that if the return code is not enough for some
situations, e.g, what exception is thrown exactly, or what cause
VM exit
abnormally. IMHO, it is still necessary for us.
Hi Jimmy,
See attached test. It demonstrates VM forking. The test saves VM
output and prints it in the end.
So I expect that unit tests for 'instrument' module can do the same:
fork VM with predefined args, save output and compare it with expected
output.
BWT, we have utility class[1] in 'support' for this task. It makes
sense to improve it for our needs.
Thanks,
Stepan.
Thanks Stepan, this is very attractive to me :)
According to your approach, I believe now it can be automatized well, at
least for many test.
One concern from me is that, how do you handle output comparison? For an
example, if VM halt with a exception, it output some message, so you get
the output, find the exception name in it? And what can we do if it
output some information only, which RI and Harmony may not appear the same?
However this is a good idea, if no objections, I shall follow this
approach in writing some test of instrument.
[1]
http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Exec.java?revision=386058&view=markup
<http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Exec.java?revision=386058&view=markup>
--
Best Regards!
Jimmy, Jing Lv
China Software Development Lab, IBM
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]