harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Harley <george.c.har...@googlemail.com>
Subject Re: [classlib][testing]resource files: location and usage
Date Mon, 19 Jun 2006 11:54:39 GMT
Hello Vladimir,

The "agreements" page on the web site [1] is also of interest here 
although it does not dive into any details beyond asking that all 
resource files go under "<module root>/src/test/resources."

Seeing as you are canvassing for opinions then my shiny 2 Euro cents 
worth is that:


* it is alright for individual modules to have autonomy with regards to 
layout under <module root>/src/test/resources but IMHO 
serialization/<package name>/... is nicer as it makes it clear 
immediately what kind of resource will be found under the particular 
child folder of "resources". Take a look at the way the beans module is 
just now to see what I mean.

* likewise, it would be helpful if there was a convention for the file 
extension of serialized data files. It seems to me that the ".ser" 
extension is more widely used in the world outside Harmony but, so long 
as the file in question is located in a folder with "serialization" in 
the path name, then the purpose of the file should be clear to us all.

* so long as the serialization data files (of whatever extension) are 
available on the classpath (in whatever location) at test time then I 
don't personally see the need for a System property to help the test 
class find them.


Provided the approach is clear and consistent in a given module then 
there should be no need for any of us to lose sleep on the matter.


Best regards,
George

[1] 
http://incubator.apache.org/harmony/subcomponents/classlibrary/agreements.html



Vladimir Ivanov wrote:
> It would be good if the page
> http://incubator.apache.org/harmony/subcomponents/classlibrary/testing.htmldescribes

>
> also location, name convention and
> access model for resource files used for testing, specifically, for 
> testing
> serialization.
>
> At the present moment test's resource files stored in 
> "src/test/resources"
> directory in modules structure.
> Serialization data stored as
>    "resources/" +  "serialization/"  + "<package name>" or
>    "resources/" +  "<package name>" + "/serialization/"
> with ".ser" or ".dat" extension.
>
> Other resource files are stored in "resources/" or in the
> "resources/<package name>" directory.
>
> I found two mechanisms of accessing resources in tests:
> 1) Get resource through ClassLoader.getResource("serialization/<package
> name>")
> 2) Get resource through reading file System.getProperty(RESOURCE_DIR +
> filename).
>
> Suggestion:
> 1) Ideal from my point of view variant: lets uniform access to resources
> throughout all tests (I can do it).
> 2) If it's not good idea, then, lets just describe technique of working
> with resources on testing conventions page to limit the number of access
> techniques to only two (I can do it).
>
> Thoughts?
>
> Thanks,
>  Vladimir
>


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


Mime
View raw message