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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Compulinkltd
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Matthieu BROUILLARD-3
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 <[hidden email]>
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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

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

Compulinkltd
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 <[hidden email]>
> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]