You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Grzegorz Kossakowski <gk...@apache.org> on 2008/01/15 02:27:46 UTC

Re: svn commit: r611986 - in /cocoon/trunk/core/cocoon-servlet-service: cocoon-servlet-service-components/ cocoon-servlet-service-components/src/ cocoon-servlet-service-components/src/main/java/org/apache/cocoon/servletservice/components/ cocoon-servlet-se...

gkossakowski@apache.org pisze:
> Author: gkossakowski
> Date: Mon Jan 14 17:19:28 2008
> New Revision: 611986
> 
> URL: http://svn.apache.org/viewvc?rev=611986&view=rev
> Log:
> COCOON-2161: Fixed bug in creation of absolute URI and added test case covering this functionality.

I'm not sure how to say this but... Guys, there is a lot of to cover by test in this module and
writing tests in trunk is not painful by any means.

This bug clearly positively proves we need to have strong test-coverage for
cocoon-servlet-service-components as it actually impacts every bit of Cocoon.

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

Re: Integration tests

Posted by Reinhard Poetz <re...@apache.org>.
Grzegorz Kossakowski wrote:
> Reinhard Poetz pisze:
>> Grzegorz Kossakowski wrote:
>>> gkossakowski@apache.org pisze:
>>>
>>> I'm not sure how to say this but... Guys, there is a lot of to cover
>>> by test
>>> in this module and writing tests in trunk is not painful by any means.
>> you are right and this particular bug was my fault because I haven't
>> written any
>> tests yet. However, if you followed my commit messages, you saw that I
>> was able
>> to enable integration tests for trunk ('mvn install -P it' from
>> cocoon-webapp runs the tests in cocoon-webapp/src/test/java). My next
>> step on my todo list is covering the SSF with tests.
> 
> Yes I was very happy to see your commits. However, I always thought that it's first that you write
> unit tests for covering the most basic functionality and ITs for testing how different parts
> interact with each other.
> 
> Doesn't it make sense to write a few unit tests first? What kind of ITs do you plan to write?
> 
>> Could somebody with admin rights on vmbuild help me with adding the
>> integration tests to Continuum?
> 
> Sure, tell what command exactly is needed to be fired. Is mvn clean install -P allbocks,it enough?
> 


-- 
Reinhard Pötz                            Managing Director, {Indoqa} GmbH
                           http://www.indoqa.com/en/people/reinhard.poetz/

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member, PMC Chair        reinhard@apache.org
_________________________________________________________________________

Re: Integration tests

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Jan 15, 2008 9:44 PM, Reinhard Poetz <re...@apache.org> wrote:
> Grzegorz Kossakowski wrote:
> > ...I
> > guess it should be always easier to write isolated unit tests than ITs. Am I
> > wrong?
>
> hmmm, it depends. Integration tests for Cocoon have always been tests at
> HTTP/XHTML level....

Might be just a question of terminology. When you're creating an HTTP
servlet, it is not really usable outside of an HTTP environment.

So (and test purists might hate me for saying that ;-), one could
argue that testing servlets via HTTP is actually a unit test. It's
just that it happens over HTTP instead of being just java method
calls.

-Bertrand

Re: Integration tests

Posted by Reinhard Poetz <re...@apache.org>.
Grzegorz Kossakowski wrote:
> Reinhard Poetz pisze:
>> Grzegorz Kossakowski wrote:
>>> Reinhard Poetz pisze:
>>> 
>>> Yes I was very happy to see your commits. However, I always thought that
>>> it's first that you write unit tests for covering the most basic 
>>> functionality and ITs for testing how different parts interact with each
>>> other.
>>> 
>>> Doesn't it make sense to write a few unit tests first?
>> :-) yes, I fully agree. However, I wanted to explore the code by writing 
>> unit tests but I failed. Maybe I invested to less time but I came to the 
>> conclustion that it is easier to write integration tests.
> 
> I don't understand what you mean exactly. Do you mean it was too complicated
> to write unit tests? I haven't taken a closer look at your IT work but I
> guess it should be always easier to write isolated unit tests than ITs. Am I
> wrong?

hmmm, it depends. Integration tests for Cocoon have always been tests at 
HTTP/XHTML level. The only difficult part is setting up the environment. 
Everything else is checking if an http call produces the right output which is 
fairly easy using XPath asserts or XMLDiff.

>>> What kind of ITs do you plan to write?
>> I want to test ... o absolute and relative connections to servlet services 
>> o connecting to blocks using the servlet:/ protocol o super connections o
>> accessing information coming from the original request o error handling o
>> postable sources o servlet-service generator/transformer/serializer
> 
> I don't want to be pesky but... most of these items looks like perfect cases
> for unit tests. Don't they?
> 
> I'm not feeling good about testing basic functionality by using ITs because
> it introduces too much dependencies, IMHO. 

What kind of dependencies?

> It was Daniel who taught me how to
> keep number of dependencies in tests as small as possible. He was endlessly
> reminding me when I was working during GSoC to use classes inheriting from
> pure TestCase and now I see he was perfectly right.
> 
> Tests are normal code, the more complicated dependencies you introduce the
> more it's hard to maintain such code...

My problem is that the time that I can dedicate to this task is very limited and 
I fear that if it gets too complicated (for me) or time-consuming I won't do it.

>>> Sure, tell what command exactly is needed to be fired. Is mvn clean 
>>> install -P allbocks,it enough?
>> yes
> 
> Configuration at Continuum updated.

Thanks!

-- 
Reinhard Pötz                            Managing Director, {Indoqa} GmbH
                           http://www.indoqa.com/en/people/reinhard.poetz/

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member, PMC Chair        reinhard@apache.org
_________________________________________________________________________

Re: Integration tests

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Reinhard Poetz pisze:
> Grzegorz Kossakowski wrote:
>> Reinhard Poetz pisze:
>>
>> Yes I was very happy to see your commits. However, I always thought
>> that it's
>> first that you write unit tests for covering the most basic
>> functionality and
>> ITs for testing how different parts interact with each other.
>>
>> Doesn't it make sense to write a few unit tests first? 
> 
> :-) yes, I fully agree. However, I wanted to explore the code by writing
> unit tests but I failed. Maybe I invested to less time but I came to the
> conclustion that it is easier to write integration tests.

I don't understand what you mean exactly. Do you mean it was too complicated to write unit tests? I
haven't taken a closer look at your IT work but I guess it should be always easier to write isolated
unit tests than ITs. Am I wrong?

>> What kind of ITs do you plan to write?
> 
> I want to test ...
>  o absolute and relative connections to servlet services
>  o connecting to blocks using the servlet:/ protocol
>  o super connections
>  o accessing information coming from the original request
>  o error handling
>  o postable sources
>  o servlet-service generator/transformer/serializer

I don't want to be pesky but... most of these items looks like perfect cases for unit tests. Don't they?

I'm not feeling good about testing basic functionality by using ITs because it introduces too much
dependencies, IMHO. It was Daniel who taught me how to keep number of dependencies in tests as small
as possible. He was endlessly reminding me when I was working during GSoC to use classes inheriting
from pure TestCase and now I see he was perfectly right.

Tests are normal code, the more complicated dependencies you introduce the more it's hard to
maintain such code...

>>
>> Sure, tell what command exactly is needed to be fired. Is mvn clean
>> install
>> -P allbocks,it enough?
> 
> yes

Configuration at Continuum updated.

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

Re: Integration tests

Posted by Reinhard Poetz <re...@apache.org>.
Grzegorz Kossakowski wrote:
> Reinhard Poetz pisze:
>> Grzegorz Kossakowski wrote:
>>> gkossakowski@apache.org pisze:
>>> 
>>> I'm not sure how to say this but... Guys, there is a lot of to cover by
>>> test in this module and writing tests in trunk is not painful by any
>>> means.
>> you are right and this particular bug was my fault because I haven't 
>> written any tests yet. However, if you followed my commit messages, you saw
>> that I was able to enable integration tests for trunk ('mvn install -P it'
>> from cocoon-webapp runs the tests in cocoon-webapp/src/test/java). My next 
>> step on my todo list is covering the SSF with tests.
> 
> Yes I was very happy to see your commits. However, I always thought that it's
> first that you write unit tests for covering the most basic functionality and
> ITs for testing how different parts interact with each other.
> 
> Doesn't it make sense to write a few unit tests first? 

:-) yes, I fully agree. However, I wanted to explore the code by writing unit 
tests but I failed. Maybe I invested to less time but I came to the conclustion 
that it is easier to write integration tests.

> What kind of ITs do you plan to write?

I want to test ...
  o absolute and relative connections to servlet services
  o connecting to blocks using the servlet:/ protocol
  o super connections
  o accessing information coming from the original request
  o error handling
  o postable sources
  o servlet-service generator/transformer/serializer

>> Could somebody with admin rights on vmbuild help me with adding the 
>> integration tests to Continuum?
> 
> Sure, tell what command exactly is needed to be fired. Is mvn clean install
> -P allbocks,it enough?

yes

-- 
Reinhard Pötz                            Managing Director, {Indoqa} GmbH
                           http://www.indoqa.com/en/people/reinhard.poetz/

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member, PMC Chair        reinhard@apache.org
_________________________________________________________________________

Re: Integration tests

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Reinhard Poetz pisze:
> Grzegorz Kossakowski wrote:
>> gkossakowski@apache.org pisze:
>>
>> I'm not sure how to say this but... Guys, there is a lot of to cover
>> by test
>> in this module and writing tests in trunk is not painful by any means.
> 
> you are right and this particular bug was my fault because I haven't
> written any
> tests yet. However, if you followed my commit messages, you saw that I
> was able
> to enable integration tests for trunk ('mvn install -P it' from
> cocoon-webapp runs the tests in cocoon-webapp/src/test/java). My next
> step on my todo list is covering the SSF with tests.

Yes I was very happy to see your commits. However, I always thought that it's first that you write
unit tests for covering the most basic functionality and ITs for testing how different parts
interact with each other.

Doesn't it make sense to write a few unit tests first? What kind of ITs do you plan to write?

> Could somebody with admin rights on vmbuild help me with adding the
> integration tests to Continuum?

Sure, tell what command exactly is needed to be fired. Is mvn clean install -P allbocks,it enough?

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

Integration tests

Posted by Reinhard Poetz <re...@apache.org>.
Grzegorz Kossakowski wrote:
> gkossakowski@apache.org pisze:
>> Author: gkossakowski Date: Mon Jan 14 17:19:28 2008 New Revision: 611986
>> 
>> URL: http://svn.apache.org/viewvc?rev=611986&view=rev Log: COCOON-2161:
>> Fixed bug in creation of absolute URI and added test case covering this
>> functionality.
> 
> I'm not sure how to say this but... Guys, there is a lot of to cover by test
> in this module and writing tests in trunk is not painful by any means.

you are right and this particular bug was my fault because I haven't written any
tests yet. However, if you followed my commit messages, you saw that I was able
to enable integration tests for trunk ('mvn install -P it' from
cocoon-webapp runs the tests in cocoon-webapp/src/test/java). My next step on my 
todo list is covering the SSF with tests.

Could somebody with admin rights on vmbuild help me with adding the integration 
tests to Continuum?

-- 
Reinhard Pötz                            Managing Director, {Indoqa} GmbH
                           http://www.indoqa.com/en/people/reinhard.poetz/

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member, PMC Chair        reinhard@apache.org
_________________________________________________________________________