You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Bruce Alspaugh <co...@gmail.com> on 2018/09/28 04:04:38 UTC

Using POJO Tests: setUp() and tearDown() methods

I was using Surefire's ability to run POJO tests as described here:

https://maven.apache.org/surefire/maven-surefire-plugin/examples/pojo-test.html

I noticed my setUp() and tearDown() methods were not being called. 
However, when I make those methods static they are called. I didn't see 
a requirement that the methods have to be static in the documentation. 
Is that a bug in the software or the documentation?

Bruce


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Using POJO Tests: setUp() and tearDown() methods

Posted by Bruce Alspaugh <co...@gmail.com>.
I have used both JUnit and TestNG with Maven. I like to keep my tests as 
independent of the test framework as possible so I can switch back and 
forth and upgrade to new framework versions as they come out without 
having to rewrite potentially thousands of tests. By writing my tests as 
described in the POJO testing documentation, it is easy to switch from 
one test framework to another. The simple and very lightweight POJO test 
support in Surefire is adequate for my needs.

That said, I would be fine if the Maven team were to refactor the POJO 
testing support in Surefire into its own stand-alone testing framework, 
so long as Maven supported that framework the same way it currently 
supports JUnit and TestNG.

My preference would be that the setUp() and tearDown() methods be normal 
non-static methods as described in the documentation to be called.

Bruce

On 09/28/2018 02:55 AM, Matthieu BROUILLARD wrote:
> I wasn't even aware that surefire had such a functionnality. I even do not
> understand why it does.
> If you want to do unit tests I would suggest you to use a real unit test
> framework like junit, testng, ...
> IMHO surefire should just be an orcherstrator and should not provide
> functionnalities to replace a unit test framework.
>
> Unfortunately it does not help you that much on this POJO test topic.
>
> Matthieu
>
>
> On Fri, Sep 28, 2018 at 6:04 AM Bruce Alspaugh <co...@gmail.com>
> wrote:
>
>> I was using Surefire's ability to run POJO tests as described here:
>>
>>
>> https://maven.apache.org/surefire/maven-surefire-plugin/examples/pojo-test.html
>>
>> I noticed my setUp() and tearDown() methods were not being called.
>> However, when I make those methods static they are called. I didn't see
>> a requirement that the methods have to be static in the documentation.
>> Is that a bug in the software or the documentation?
>>
>> Bruce
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Using POJO Tests: setUp() and tearDown() methods

Posted by Matthieu BROUILLARD <ma...@brouillard.fr>.
I wasn't even aware that surefire had such a functionnality. I even do not
understand why it does.
If you want to do unit tests I would suggest you to use a real unit test
framework like junit, testng, ...
IMHO surefire should just be an orcherstrator and should not provide
functionnalities to replace a unit test framework.

Unfortunately it does not help you that much on this POJO test topic.

Matthieu


On Fri, Sep 28, 2018 at 6:04 AM Bruce Alspaugh <co...@gmail.com>
wrote:

> I was using Surefire's ability to run POJO tests as described here:
>
>
> https://maven.apache.org/surefire/maven-surefire-plugin/examples/pojo-test.html
>
> I noticed my setUp() and tearDown() methods were not being called.
> However, when I make those methods static they are called. I didn't see
> a requirement that the methods have to be static in the documentation.
> Is that a bug in the software or the documentation?
>
> Bruce
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>