You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-dev@incubator.apache.org by Alexandru Popescu <th...@gmail.com> on 2006/02/06 11:17:28 UTC

test changes

Hi!

I would like to kindly ask you to take a look at the attached zip. It suggests a new approach for 
the tests.

The changes:

1/ each testcase that needs to run against a repository has a suite() method that wraps the 
TestSuite inside a RepositoryLifecycleTestSetup

This allows running each test by its own and guarantees that the repository is correctly started 
only once and closed afterwards.

2/ each package contains a AllTests class that has mainly 2 methods:

- suite() that wrappes inside a RepositoryLifecycleTestSetup a simple TestSuite: this is too allow 
to run all tests inside a package. As above it guarantees that the repository is started only once 
and closed afterwards

- simpleSuite(): returns a normal TestSuite(). This method is used by the main AllTests class that 
provides the suite for the whole graffito jcr

3/ org.apache.portals.graffito.jcr.AllTests

creates the suite for all tests

It may look a little tedious and it requires a little more work to be done when creating tests. 
However this has the advantage that you can run individual tests, package level tests and the whole 
suite without worrying about the repository startup and close. It was implemented this way because 
of the OutOfMemoryError problem I have reported to Jackrabbit ml (it looks like it is a problem with 
Derby not releasing the resources). However, I still believe that creating a repository only once 
before a suite is run and assuring that it is closed afterwards is the good and correct strategy.

What do you think?

./alex
--
.w( the_mindstorm )p.

ps: if you agree with these changes, than somebody that knows Maven should instruct it to run only 
org.apache.portals.graffito.jcr.AllTests.

Re: test changes

Posted by Alexandru Popescu <th...@gmail.com>.
#: Christophe Lombart changed the world a bit at a time by saying (astral date: 2/6/2006 1:50 PM) :#
> Yes, it seems better to run unit test like this
> 
> For maven setup, review in the jcr-mapping project.xml the unit
> definition like this
> 
> <unitTest>
> 			<includes>
> 				<include>
> 					org/apache/portals/graffito/jcr/AllTests.java
> 				</include>	
> 			</includes>	
> 			<!-- excludes>
> 			<exclude>
> 				org/apache/portals/graffito/jcr/testmodel/**/*.java
> 			</exclude>
> 			<exclude>**/*TestBase.java</exclude>
> 			</excludes -->			
> 			<resources>
> 				<resource>
> 					<directory>${basedir}/src/test</directory>
> 					<excludes>
> 						<exclude>**/*.java</exclude>
> 					</excludes>
> 				</resource>
> 			</resources>
> 		</unitTest>
> 
>

Thanks Christophe. I will try the Maven changes locally.

./alex
--
.w( the_mindstorm )p.


> On 2/6/06, Alexandru Popescu <th...@gmail.com> wrote:
>> Hi!
>>
>> I would like to kindly ask you to take a look at the attached zip. It suggests a new approach for
>> the tests.
>>
>> The changes:
>>
>> 1/ each testcase that needs to run against a repository has a suite() method that wraps the
>> TestSuite inside a RepositoryLifecycleTestSetup
>>
>> This allows running each test by its own and guarantees that the repository is correctly started
>> only once and closed afterwards.
>>
>> 2/ each package contains a AllTests class that has mainly 2 methods:
>>
>> - suite() that wrappes inside a RepositoryLifecycleTestSetup a simple TestSuite: this is too allow
>> to run all tests inside a package. As above it guarantees that the repository is started only once
>> and closed afterwards
>>
>> - simpleSuite(): returns a normal TestSuite(). This method is used by the main AllTests class that
>> provides the suite for the whole graffito jcr
>>
>> 3/ org.apache.portals.graffito.jcr.AllTests
>>
>> creates the suite for all tests
>>
>> It may look a little tedious and it requires a little more work to be done when creating tests.
>> However this has the advantage that you can run individual tests, package level tests and the whole
>> suite without worrying about the repository startup and close. It was implemented this way because
>> of the OutOfMemoryError problem I have reported to Jackrabbit ml (it looks like it is a problem with
>> Derby not releasing the resources). However, I still believe that creating a repository only once
>> before a suite is run and assuring that it is closed afterwards is the good and correct strategy.
>>
>> What do you think?
>>
>> ./alex
>> --
>> .w( the_mindstorm )p.
>>
>> ps: if you agree with these changes, than somebody that knows Maven should instruct it to run only
>> org.apache.portals.graffito.jcr.AllTests.
>>
>>
>>
> 
> 
> --
> Best regards,
> 
> Christophe
> 


Re: test changes

Posted by Christophe Lombart <ch...@gmail.com>.
Yes, it seems better to run unit test like this

For maven setup, review in the jcr-mapping project.xml the unit
definition like this

<unitTest>
			<includes>
				<include>
					org/apache/portals/graffito/jcr/AllTests.java
				</include>	
			</includes>	
			<!-- excludes>
			<exclude>
				org/apache/portals/graffito/jcr/testmodel/**/*.java
			</exclude>
			<exclude>**/*TestBase.java</exclude>
			</excludes -->			
			<resources>
				<resource>
					<directory>${basedir}/src/test</directory>
					<excludes>
						<exclude>**/*.java</exclude>
					</excludes>
				</resource>
			</resources>
		</unitTest>


On 2/6/06, Alexandru Popescu <th...@gmail.com> wrote:
> Hi!
>
> I would like to kindly ask you to take a look at the attached zip. It suggests a new approach for
> the tests.
>
> The changes:
>
> 1/ each testcase that needs to run against a repository has a suite() method that wraps the
> TestSuite inside a RepositoryLifecycleTestSetup
>
> This allows running each test by its own and guarantees that the repository is correctly started
> only once and closed afterwards.
>
> 2/ each package contains a AllTests class that has mainly 2 methods:
>
> - suite() that wrappes inside a RepositoryLifecycleTestSetup a simple TestSuite: this is too allow
> to run all tests inside a package. As above it guarantees that the repository is started only once
> and closed afterwards
>
> - simpleSuite(): returns a normal TestSuite(). This method is used by the main AllTests class that
> provides the suite for the whole graffito jcr
>
> 3/ org.apache.portals.graffito.jcr.AllTests
>
> creates the suite for all tests
>
> It may look a little tedious and it requires a little more work to be done when creating tests.
> However this has the advantage that you can run individual tests, package level tests and the whole
> suite without worrying about the repository startup and close. It was implemented this way because
> of the OutOfMemoryError problem I have reported to Jackrabbit ml (it looks like it is a problem with
> Derby not releasing the resources). However, I still believe that creating a repository only once
> before a suite is run and assuring that it is closed afterwards is the good and correct strategy.
>
> What do you think?
>
> ./alex
> --
> .w( the_mindstorm )p.
>
> ps: if you agree with these changes, than somebody that knows Maven should instruct it to run only
> org.apache.portals.graffito.jcr.AllTests.
>
>
>


--
Best regards,

Christophe