You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Vladimir Ivanov <iv...@gmail.com> on 2006/06/19 13:19:47 UTC

[classlib][testing]resource files: location and usage

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

Re: [classlib][testing]resource files: location and usage

Posted by George Harley <ge...@googlemail.com>.
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


Re: [classlib][testing]resource files: location and usage

Posted by Mikhail Loenko <ml...@gmail.com>.
2006/6/20, Vladimir Ivanov <iv...@gmail.com>:
> >> described on testing and serialization convention pages.
> >
> >
> >Yes, it'll be useful. But currently few resource files follow conventions
>
> Not only resource files.
> The "Testing convention" document (testing.html) says:
> 1) "Tests, their resources, and support classes are located under
> <modulename>/src/tests "
> but actually they are located under
> <modulename>/src/test
> In this case seems the document should be updated.

thanks! fixed.

>
> 2) document says:
> "<modulename>/src/tests/api - Implementation-independent tests"
> but many modules miss this level and define 'classpath tests' on this level.
> In this case tests should be relocated.

Not necessarily. the doc says: "This document provides general
guidlines and recomendations that might be adapted/modified to reflect
module specifics"

So if a module does not have some type of tests or platform division it might
skip extra folders

Thanks,
Mikhail

>
> Anyway, when one is not sure whether or not he puts the tests correctly, he
> can just run the script and receive all warnings.
>  Thanks, Vladimir
>
>
> On 6/20/06, Stepan Mishura <st...@gmail.com> wrote:
> >
> > On 6/20/06, Vladimir Ivanov wrote:
> > >
> > > Thanks Stepan,
> > >
> > > 1. The decision about other resource files is: they should be stored
> > into
> > > "src/test/resources/" without further naming convention. Right? – then,
> > > a)       Ideally, can we specify further (after src/test/resources/)
> > > naming
> > > convention for resource files as it is done for serialization files?
> >
> >
> > Resource files for testing serialization is the first case. To work out
> > further conventions we should at least understand what kinds of resource
> > files are required for testing. For example, we may agree that resource
> > files for net-based tests should be put separately in 'net' sub-folder.
> > And
> > I'd suggest  to put all other resources into 'other' folder
> > (i.esrc/test/resources/other).
> >
> > b)       At least, specify that resource file name should contain test
> > name
> > > – for easy resource file search?
> >
> >
> > Agree.
> >
> > c)       Shouldn't we move content of "<trunk>/support/" into
> > corresponding
> > > module's src/test/resources/ directories? – if yes, I can do it.
> >
> >
> > No. IIRC we agreed to move 'things' used across different modules to
> > "<trunk>/support/".
> >
> > 2. Can we add a link to the
> > >
> > >
> > http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.htmldocument
> > > at the testing page?
> >
> >
> > Sure.
> >
> > I want to create a script which checks that tests are stored as it is
> > > described on testing and serialization convention pages.
> >
> >
> > Yes, it'll be useful. But currently few resource files follow conventions
> > :-)
> >
> > Thanks,
> > Stepan.
> >
> > Thanks,
> > > Vladimir
> > >
> > > On 6/19/06, Stepan Mishura < stepan.mishura@gmail.com> wrote:
> > > >
> > > > On 6/19/06, 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).
> > > >
> > > >
> > > > Hi Vladimir,
> > > >
> > > > The second mechanismis used in 'security' testing framework (used by
> > > > auth/crypto/security/x-net modules). We are agreed to merge two
> > existing
> > > > framework for testing serialization. Currently I'm preparing update
> > for
> > > > the
> > > > 'security' framework - it will replace the second mechanism it with
> > the
> > > > first.
> > > >
> > > > Suggestion:
> > > > > 1) Ideal from my point of view variant: lets uniform access to
> > > resources
> > > > > throughout all tests (I can do it).
> > > >
> > > >
> > > > Agreed. We should work out uniform access to resources. IIRC we agreed
> > > to
> > > > access *all* resources via classpath.
> > > >
> > > > 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?
> > > >
> > > >
> > > > see [1] for name conventions for serialization resource files.
> > > >
> > > > Thanks,
> > > > Stepan.
> > > >
> > > > [1]
> > > >
> > > >
> > >
> > http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.html
> > > >
> > > > ------------------------------------------------------
> > > > 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
> >
> > > >
> > > >
> > >
> > >
> >
> > ------------------------------------------------------
> > 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
> >
> >
>
>

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


Re: [classlib][testing]resource files: location and usage

Posted by Vladimir Ivanov <iv...@gmail.com>.
>> described on testing and serialization convention pages.
>
>
>Yes, it'll be useful. But currently few resource files follow conventions

Not only resource files.
The "Testing convention" document (testing.html) says:
1) "Tests, their resources, and support classes are located under
<modulename>/src/tests "
but actually they are located under
<modulename>/src/test
In this case seems the document should be updated.

2) document says:
"<modulename>/src/tests/api - Implementation-independent tests"
but many modules miss this level and define 'classpath tests' on this level.
In this case tests should be relocated.

Anyway, when one is not sure whether or not he puts the tests correctly, he
can just run the script and receive all warnings.
 Thanks, Vladimir


On 6/20/06, Stepan Mishura <st...@gmail.com> wrote:
>
> On 6/20/06, Vladimir Ivanov wrote:
> >
> > Thanks Stepan,
> >
> > 1. The decision about other resource files is: they should be stored
> into
> > "src/test/resources/" without further naming convention. Right? – then,
> > a)       Ideally, can we specify further (after src/test/resources/)
> > naming
> > convention for resource files as it is done for serialization files?
>
>
> Resource files for testing serialization is the first case. To work out
> further conventions we should at least understand what kinds of resource
> files are required for testing. For example, we may agree that resource
> files for net-based tests should be put separately in 'net' sub-folder.
> And
> I'd suggest  to put all other resources into 'other' folder
> (i.esrc/test/resources/other).
>
> b)       At least, specify that resource file name should contain test
> name
> > – for easy resource file search?
>
>
> Agree.
>
> c)       Shouldn't we move content of "<trunk>/support/" into
> corresponding
> > module's src/test/resources/ directories? – if yes, I can do it.
>
>
> No. IIRC we agreed to move 'things' used across different modules to
> "<trunk>/support/".
>
> 2. Can we add a link to the
> >
> >
> http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.htmldocument
> > at the testing page?
>
>
> Sure.
>
> I want to create a script which checks that tests are stored as it is
> > described on testing and serialization convention pages.
>
>
> Yes, it'll be useful. But currently few resource files follow conventions
> :-)
>
> Thanks,
> Stepan.
>
> Thanks,
> > Vladimir
> >
> > On 6/19/06, Stepan Mishura < stepan.mishura@gmail.com> wrote:
> > >
> > > On 6/19/06, 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).
> > >
> > >
> > > Hi Vladimir,
> > >
> > > The second mechanismis used in 'security' testing framework (used by
> > > auth/crypto/security/x-net modules). We are agreed to merge two
> existing
> > > framework for testing serialization. Currently I'm preparing update
> for
> > > the
> > > 'security' framework - it will replace the second mechanism it with
> the
> > > first.
> > >
> > > Suggestion:
> > > > 1) Ideal from my point of view variant: lets uniform access to
> > resources
> > > > throughout all tests (I can do it).
> > >
> > >
> > > Agreed. We should work out uniform access to resources. IIRC we agreed
> > to
> > > access *all* resources via classpath.
> > >
> > > 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?
> > >
> > >
> > > see [1] for name conventions for serialization resource files.
> > >
> > > Thanks,
> > > Stepan.
> > >
> > > [1]
> > >
> > >
> >
> http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.html
> > >
> > > ------------------------------------------------------
> > > 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
>
> > >
> > >
> >
> >
>
> ------------------------------------------------------
> 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
>
>

Re: [classlib][testing]resource files: location and usage

Posted by Vladimir Ivanov <iv...@gmail.com>.
>Yes, it'll be useful. But currently few resource files follow conventions

only 4 files ...
I created HARMONY-641 with small script to check serialization data file
names.
Results can be placed on wiki or web if needed – is it needed?

 Thanks, Vladimir

On 6/20/06, Stepan Mishura <st...@gmail.com> wrote:

> On 6/20/06, Vladimir Ivanov wrote:
> >
> > Thanks Stepan,
> >
> > 1. The decision about other resource files is: they should be stored
> into
> > "src/test/resources/" without further naming convention. Right? – then,
> > a)       Ideally, can we specify further (after src/test/resources/)
> > naming
> > convention for resource files as it is done for serialization files?
>
>
> Resource files for testing serialization is the first case. To work out
> further conventions we should at least understand what kinds of resource
> files are required for testing. For example, we may agree that resource
> files for net-based tests should be put separately in 'net' sub-folder.
> And
> I'd suggest  to put all other resources into 'other' folder
> (i.esrc/test/resources/other).
>
> b)       At least, specify that resource file name should contain test
> name
> > – for easy resource file search?
>
>
> Agree.
>
> c)       Shouldn't we move content of "<trunk>/support/" into
> corresponding
> > module's src/test/resources/ directories? – if yes, I can do it.
>
>
> No. IIRC we agreed to move 'things' used across different modules to
> "<trunk>/support/".
>
> 2. Can we add a link to the
> >
> >
> http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.htmldocument
> > at the testing page?
>
>
> Sure.
>
> I want to create a script which checks that tests are stored as it is
> > described on testing and serialization convention pages.
>
>
> Yes, it'll be useful. But currently few resource files follow conventions
> :-)
>
> Thanks,
> Stepan.
>
> Thanks,
> > Vladimir
> >
> > On 6/19/06, Stepan Mishura < stepan.mishura@gmail.com> wrote:
> > >
> > > On 6/19/06, 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).
> > >
> > >
> > > Hi Vladimir,
> > >
> > > The second mechanismis used in 'security' testing framework (used by
> > > auth/crypto/security/x-net modules). We are agreed to merge two
> existing
> > > framework for testing serialization. Currently I'm preparing update
> for
> > > the
> > > 'security' framework - it will replace the second mechanism it with
> the
> > > first.
> > >
> > > Suggestion:
> > > > 1) Ideal from my point of view variant: lets uniform access to
> > resources
> > > > throughout all tests (I can do it).
> > >
> > >
> > > Agreed. We should work out uniform access to resources. IIRC we agreed
> > to
> > > access *all* resources via classpath.
> > >
> > > 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?
> > >
> > >
> > > see [1] for name conventions for serialization resource files.
> > >
> > > Thanks,
> > > Stepan.
> > >
> > > [1]
> > >
> > >
> >
> http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.html
> > >
> > > ------------------------------------------------------
> > > 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
>
> > >
> > >
> >
> >
>
> ------------------------------------------------------
> 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
>
>

Re: [classlib][testing]resource files: location and usage

Posted by Stepan Mishura <st...@gmail.com>.
On 6/20/06, Vladimir Ivanov wrote:
>
> Thanks Stepan,
>
> 1. The decision about other resource files is: they should be stored into
> "src/test/resources/" without further naming convention. Right? – then,
> a)       Ideally, can we specify further (after src/test/resources/)
> naming
> convention for resource files as it is done for serialization files?


 Resource files for testing serialization is the first case. To work out
further conventions we should at least understand what kinds of resource
files are required for testing. For example, we may agree that resource
files for net-based tests should be put separately in 'net' sub-folder. And
I'd suggest  to put all other resources into 'other' folder
(i.esrc/test/resources/other).

b)       At least, specify that resource file name should contain test name
> – for easy resource file search?


Agree.

c)       Shouldn't we move content of "<trunk>/support/" into corresponding
> module's src/test/resources/ directories? – if yes, I can do it.


No. IIRC we agreed to move 'things' used across different modules to
"<trunk>/support/".

2. Can we add a link to the
>
> http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.htmldocument
> at the testing page?


Sure.

I want to create a script which checks that tests are stored as it is
> described on testing and serialization convention pages.


Yes, it'll be useful. But currently few resource files follow conventions
:-)

Thanks,
Stepan.

Thanks,
> Vladimir
>
> On 6/19/06, Stepan Mishura <st...@gmail.com> wrote:
> >
> > On 6/19/06, 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).
> >
> >
> > Hi Vladimir,
> >
> > The second mechanismis used in 'security' testing framework (used by
> > auth/crypto/security/x-net modules). We are agreed to merge two existing
> > framework for testing serialization. Currently I'm preparing update for
> > the
> > 'security' framework - it will replace the second mechanism it with the
> > first.
> >
> > Suggestion:
> > > 1) Ideal from my point of view variant: lets uniform access to
> resources
> > > throughout all tests (I can do it).
> >
> >
> > Agreed. We should work out uniform access to resources. IIRC we agreed
> to
> > access *all* resources via classpath.
> >
> > 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?
> >
> >
> > see [1] for name conventions for serialization resource files.
> >
> > Thanks,
> > Stepan.
> >
> > [1]
> >
> >
> http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.html
> >
> > ------------------------------------------------------
> > 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
> >
> >
>
>

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

Re: [classlib][testing]resource files: location and usage

Posted by Vladimir Ivanov <iv...@gmail.com>.
>It does not work well. Single resource might be used by many tests

OK.
But in the other case, when one resource is used by one tests (I believe
most typical situation), lets name the resource file using test name.

 Thanks, Vladimir


On 6/20/06, Mikhail Loenko <mloenko@gmail.com > wrote:
>
> 2006/6/20, Vladimir Ivanov < ivavladimir@gmail.com>:
> > Thanks Stepan,
> >
> > 1. The decision about other resource files is: they should be stored
> into
> > "src/test/resources/" without further naming convention. Right? – then,
> > a)       Ideally, can we specify further (after src/test/resources/)
> naming
> > convention for resource files as it is done for serialization files?
> > b)       At least, specify that resource file name should contain test
> name
> > – for easy resource file search?
>
> It does not work well. Single resource might be used by many tests
>
> > c)       Shouldn't we move content of "<trunk>/support/" into
> corresponding
> > module's src/test/resources/ directories? – if yes, I can do it.
>
> +1
>
> It smells like we already discussed that and agreed to distribute
> trunk/support
> between modules. not sure.
>
> Thanks,
> Mikhail
>
>
>
> >
> > 2. Can we add a link to the
> > http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.htmldocument
>
> > at the testing page?
> >
> > I want to create a script which checks that tests are stored as it is
> > described on testing and serialization convention pages.
> >
> >  Thanks,
> >  Vladimir
> >
> > On 6/19/06, Stepan Mishura <stepan.mishura@gmail.com > wrote:
> > >
> > > On 6/19/06, 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).
> > >
> > >
> > > Hi Vladimir,
> > >
> > > The second mechanismis used in 'security' testing framework (used by
> > > auth/crypto/security/x-net modules). We are agreed to merge two
> existing
> > > framework for testing serialization. Currently I'm preparing update
> for
> > > the
> > > 'security' framework - it will replace the second mechanism it with
> the
> > > first.
> > >
> > > Suggestion:
> > > > 1) Ideal from my point of view variant: lets uniform access to
> resources
> > > > throughout all tests (I can do it).
> > >
> > >
> > > Agreed. We should work out uniform access to resources. IIRC we agreed
> to
> > > access *all* resources via classpath.
> > >
> > > 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?
> > >
> > >
> > > see [1] for name conventions for serialization resource files.
> > >
> > > Thanks,
> > > Stepan.
> > >
> > > [1]
> > >
> > >
> http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.html
> > >
> > > ------------------------------------------------------
> > > 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
> > >
> > >
> >
> >
>
> ---------------------------------------------------------------------
> 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
>
>

Re: [classlib][testing]resource files: location and usage

Posted by Mikhail Loenko <ml...@gmail.com>.
2006/6/20, Vladimir Ivanov <iv...@gmail.com>:
> Thanks Stepan,
>
> 1. The decision about other resource files is: they should be stored into
> "src/test/resources/" without further naming convention. Right? – then,
> a)       Ideally, can we specify further (after src/test/resources/) naming
> convention for resource files as it is done for serialization files?
> b)       At least, specify that resource file name should contain test name
> – for easy resource file search?

It does not work well. Single resource might be used by many tests

> c)       Shouldn't we move content of "<trunk>/support/" into corresponding
> module's src/test/resources/ directories? – if yes, I can do it.

+1

It smells like we already discussed that and agreed to distribute trunk/support
between modules. not sure.

Thanks,
Mikhail



>
> 2. Can we add a link to the
> http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.htmldocument
> at the testing page?
>
> I want to create a script which checks that tests are stored as it is
> described on testing and serialization convention pages.
>
>  Thanks,
>  Vladimir
>
> On 6/19/06, Stepan Mishura <st...@gmail.com> wrote:
> >
> > On 6/19/06, 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).
> >
> >
> > Hi Vladimir,
> >
> > The second mechanismis used in 'security' testing framework (used by
> > auth/crypto/security/x-net modules). We are agreed to merge two existing
> > framework for testing serialization. Currently I'm preparing update for
> > the
> > 'security' framework - it will replace the second mechanism it with the
> > first.
> >
> > Suggestion:
> > > 1) Ideal from my point of view variant: lets uniform access to resources
> > > throughout all tests (I can do it).
> >
> >
> > Agreed. We should work out uniform access to resources. IIRC we agreed to
> > access *all* resources via classpath.
> >
> > 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?
> >
> >
> > see [1] for name conventions for serialization resource files.
> >
> > Thanks,
> > Stepan.
> >
> > [1]
> >
> > http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.html
> >
> > ------------------------------------------------------
> > 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
> >
> >
>
>

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


Re: [classlib][testing]resource files: location and usage

Posted by Vladimir Ivanov <iv...@gmail.com>.
Thanks Stepan,

1. The decision about other resource files is: they should be stored into
"src/test/resources/" without further naming convention. Right? – then,
a)       Ideally, can we specify further (after src/test/resources/) naming
convention for resource files as it is done for serialization files?
b)       At least, specify that resource file name should contain test name
– for easy resource file search?
c)       Shouldn't we move content of "<trunk>/support/" into corresponding
module's src/test/resources/ directories? – if yes, I can do it.

2. Can we add a link to the
http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.htmldocument
at the testing page?

I want to create a script which checks that tests are stored as it is
described on testing and serialization convention pages.

 Thanks,
  Vladimir

On 6/19/06, Stepan Mishura <st...@gmail.com> wrote:
>
> On 6/19/06, 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).
>
>
> Hi Vladimir,
>
> The second mechanismis used in 'security' testing framework (used by
> auth/crypto/security/x-net modules). We are agreed to merge two existing
> framework for testing serialization. Currently I'm preparing update for
> the
> 'security' framework - it will replace the second mechanism it with the
> first.
>
> Suggestion:
> > 1) Ideal from my point of view variant: lets uniform access to resources
> > throughout all tests (I can do it).
>
>
> Agreed. We should work out uniform access to resources. IIRC we agreed to
> access *all* resources via classpath.
>
> 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?
>
>
> see [1] for name conventions for serialization resource files.
>
> Thanks,
> Stepan.
>
> [1]
>
> http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.html
>
> ------------------------------------------------------
> 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
>
>

Re: [classlib][testing]resource files: location and usage

Posted by Tim Ellison <t....@gmail.com>.
Anton Luht wrote:
>> Indeed, unless you are extremely paranoid that all the other API
>> implementations wrong, but are conspiring to make your test pass then
>> you should assume that everything else is working ok and you are testing
>> some specific piece of functionality.
> 
> Why should we have gold files then? Let's imagine we test
> deserialization. According to your proposal - we suppose that
> serialization works fine then. Let's serialize something in a file or
> an array, deserialize and compare - if non-transient fields are equal,
> it's OK.

Yes, for *compatibility* we need some external data like the
serialization data.

> I suggest to trust only resources created outside Harmony VM - for
> example, created by Java executed in RI, application on any other
> language but Java or taken from SVN.

Hopefully you don't mean that literally.  If you don't trust anything
created by the Harmony VM then you can not implement a meaningful test.

> Only paranoids survive :)

But a little trust will get us further faster ;-)

Regards,
Tim


-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

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


Re: [classlib][testing]resource files: location and usage

Posted by Anton Luht <an...@gmail.com>.
> Indeed, unless you are extremely paranoid that all the other API
> implementations wrong, but are conspiring to make your test pass then
> you should assume that everything else is working ok and you are testing
> some specific piece of functionality.

Why should we have gold files then? Let's imagine we test
deserialization. According to your proposal - we suppose that
serialization works fine then. Let's serialize something in a file or
an array, deserialize and compare - if non-transient fields are equal,
it's OK.

I suggest to trust only resources created outside Harmony VM - for
example, created by Java executed in RI, application on any other
language but Java or taken from SVN.

Only paranoids survive :)

-- 
Regards,
Anton Luht,
Intel Middleware Products Division

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


Re: [classlib][testing]resource files: location and usage

Posted by Tim Ellison <t....@gmail.com>.
Vladimir Ivanov wrote:
> On 6/20/06, Gregory Shimansky <gs...@gmail.com> wrote:
> 
>> On Monday 19 June 2006 20:33 Anton Luht wrote:
>> > It is not a good idea to put creation of such resources in something
>> > like setUp() method in JUnit test because who knows if a read-only
>> > file created by VM under test is really read-only or not :)
>>
>> Extending this question would be how do you know that JUnit framework
>> executed
>> by VM under test does actually produce the correct results?
>>
>> I think there should be some minimal trust in the means which tests use,
>> resources creation included into it. It would be a good starting point at
>> least for now.
> 
> I agree, and even more - when we test some API we assume that the rest of
> API works fine.
> 
> So if the method-not-under-test is used to create the resource it is OK to
> do it in the setUp()
> method.

Indeed, unless you are extremely paranoid that all the other API
implementations wrong, but are conspiring to make your test pass then
you should assume that everything else is working ok and you are testing
some specific piece of functionality.

Our ability to run real world applications is part of the sanity check too.

Regards,
Tim

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

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


Re: [classlib][testing]resource files: location and usage

Posted by Vladimir Ivanov <iv...@gmail.com>.
On 6/20/06, Gregory Shimansky <gs...@gmail.com> wrote:

> On Monday 19 June 2006 20:33 Anton Luht wrote:
> > It is not a good idea to put creation of such resources in something
> > like setUp() method in JUnit test because who knows if a read-only
> > file created by VM under test is really read-only or not :)
>
> Extending this question would be how do you know that JUnit framework
> executed
> by VM under test does actually produce the correct results?
>
> I think there should be some minimal trust in the means which tests use,
> resources creation included into it. It would be a good starting point at
> least for now.



I agree, and even more - when we test some API we assume that the rest of
API works fine.

So if the method-not-under-test is used to create the resource it is OK to
do it in the setUp()
method.

 Thanks,
   Vladimir



> --
> Gregory Shimansky, Intel Middleware Products Division
>
> ---------------------------------------------------------------------
> 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
>
>

Re: [classlib][testing]resource files: location and usage

Posted by Gregory Shimansky <gs...@gmail.com>.
On Monday 19 June 2006 20:33 Anton Luht wrote:
> It is not a good idea to put creation of such resources in something
> like setUp() method in JUnit test because who knows if a read-only
> file created by VM under test is really read-only or not :)

Extending this question would be how do you know that JUnit framework executed 
by VM under test does actually produce the correct results?

I think there should be some minimal trust in the means which tests use, 
resources creation included into it. It would be a good starting point at 
least for now.

-- 
Gregory Shimansky, Intel Middleware Products Division

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


Re: [classlib][testing]resource files: location and usage

Posted by Anton Luht <an...@gmail.com>.
Good day,

It seems to me that some tests may require resources that can't be put
to SVN, for example, non-readable files. Non-writable files may fall
in this category, too - I think (sorry it I'm wrong) that after
commit/checkout from SVN they become writable by the owner. Another
example of such resources may be huge files. It's impossible to put
such resources to SVN but they may be created in the build process or
on fly before executing tests.  Maybe it's worth to specify a common
approach for such resources, maybe a build target or something like
that.

It is not a good idea to put creation of such resources in something
like setUp() method in JUnit test because who knows if a read-only
file created by VM under test is really read-only or not :)

On 6/19/06, Stepan Mishura <st...@gmail.com> wrote:
> On 6/19/06, 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).
>
>
>  Hi Vladimir,
>
> The second mechanismis used in 'security' testing framework (used by
> auth/crypto/security/x-net modules). We are agreed to merge two existing
> framework for testing serialization. Currently I'm preparing update for the
> 'security' framework - it will replace the second mechanism it with the
> first.
>
> Suggestion:
> > 1) Ideal from my point of view variant: lets uniform access to resources
> > throughout all tests (I can do it).
>
>
> Agreed. We should work out uniform access to resources. IIRC we agreed to
> access *all* resources via classpath.
>
> 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?
>
>
> see [1] for name conventions for serialization resource files.
>
> Thanks,
> Stepan.
>
> [1]
> http://incubator.apache.org/harmony/subcomponents/classlibrary/ser_testing.html
>
> ------------------------------------------------------
> 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
>
>


-- 
Regards,
Anton Luht,
Intel Middleware Products Division

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


Re: [classlib][testing]resource files: location and usage

Posted by Stepan Mishura <st...@gmail.com>.
On 6/19/06, 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).


 Hi Vladimir,

The second mechanismis used in 'security' testing framework (used by
auth/crypto/security/x-net modules). We are agreed to merge two existing
framework for testing serialization. Currently I'm preparing update for the
'security' framework - it will replace the second mechanism it with the
first.

Suggestion:
> 1) Ideal from my point of view variant: lets uniform access to resources
> throughout all tests (I can do it).


Agreed. We should work out uniform access to resources. IIRC we agreed to
access *all* resources via classpath.

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?


see [1] for name conventions for serialization resource files.

Thanks,
Stepan.

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

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