harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jimmy, Jing Lv" <firep...@gmail.com>
Subject Re: [classlib] trying new framework for testing serialization
Date Fri, 30 Jun 2006 09:40:45 GMT
Stepan Mishura wrote:
> Hi Jimmy,
> On 6/30/06, Jimmy, Jing Lv wrote:
>> Hi Stepan:
>>    Seems the new framework for serialization has added to Harmony, I'm
>> trying it and find it interesting. However I have a few questions:
>> 1. It is strange that SerializationTest is an abstract class extends
>> junit.framework.testcase,  in this case I can either (a) extends
>> SerializationTest directly, implements getData() and run, it shall run
>> "testSelf" and "testGolden", but how to control more complex situation
>> in this way? or (b) write a test extends testcase, and use static
>> methods "verifySelf" and "verifyGolden" in SerializationTest as
>> Guidelines says, however I wonder why it extends testcase?
> You should use approach described in [1]. The second way (i.e. extending
> SerializationTest) is used by 'security' serialization tests only. As we
> agreed we won't use it and all 'security' serialization tests should be
> refactored to avoid extending SerializationTest. However it hard to do at
> once. So I put stubs to "testSelf" and "testGolden" methods to let
> 'security' tests smoothly migrate to the new testing approach.
> Please follow conventions in [1] for creating new serialization tests.
> 2. It is strange verifyGolden(test, object) has two parameter, but in
>> the example in the Guidelines says:"
>>        public void testSerializationCompatibility()
>>                throws Exception {
>>            SerializationTest.verifyGolden(new SomeSerializableClass());
>>        }"  something lost?
>>    And I guess the first parameter is used only to parse the name of
>> resource file. If so, may it change the parameter to a String, or
>> something else?
> Yes, it is a mistake. Somebody already caught it and I fixed it in r417133
> but the page on the web-site didn't updated yet. So I should say:
> public void testSerializationCompatibility()
>        throws Exception {
>    SerializationTest.verifyGolden(this, new SomeSerializableClass());
> }
> The first param is TestCase instance that is used to locate golden file.
> 3. The test needs ser-files, so it may be necessary to add a method to
>> create this file easily just like the old framework. I find a protected
>> method produceGoldenFiles(), is that used for it (why protected?)? This
>> may be necessary to guildance.
>> What's more, the ser-file must be end with ".ser", but in new framework,
>> I still find it uses ".dat" . And the path is "test/common/unit/..." but
>> in Harmony's Test Guildance tells:"/src/test/resources/serialization..."
> Yes, I agree that utility method for producing golden files will be useful.
> I didn't think how to implement it yet - so suggestion and patches are
> welcome.

I see now, thank you very much Stepan! :)
To produce golden files,  I believe a little change to 
produceGoldenFiles() may meet this requirement. I'd like to help.:)
But first of all it may change its search path, as when I create a new 
test and try verifyGolden(), I find a FileNotFoundException. It seems 
trying to search "test/common/unit/.../SomeTest.golden.dat", is that 
because of serialization-test for security? Waiting for your refactoring :)

> Thanks,
> Stepan.
> [1]
> http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.html 
> Your comments? Thanks!
>> -- 
>> Best Regards!
>> Jimmy, Jing Lv
>> China Software Development Lab, IBM


Best Regards!

Jimmy, Jing Lv
China Software Development Lab, IBM

Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

View raw message