[classlib] trying new framework for testing serialization (was:Merging frameworks for testing serialization - first step)

2006-06-30 Thread Jimmy, Jing Lv

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?


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?


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...


Your comments? Thanks!

--

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]



Re: [classlib] trying new framework for testing serialization (was:Merging frameworks for testing serialization - first step)

2006-06-30 Thread Stepan Mishura

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.

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





--
Thanks,
Stepan Mishura
Intel Middleware Products Division

--
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]