You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by cablepuff <ca...@gmail.com> on 2011/08/20 13:03:17 UTC

Wicket 1.4.18: Performance of unit test observation.

Hi can someone explain to me why performance of unit testing is faster using
setUp and destory this way. 

    @Before
    public void setup() {
        if (this.authenticatedWebApp == null) {
            this.authenticatedWebApp = new AuthenticatedTestApplication();
        }
        if (this.tester == null) {
            this.tester = new WicketTester(this.authenticatedWebApp);
        }
        else {
            this.tester.setupRequestAndResponse(true);
        }
    }

   @After
    public void tearDown() {
        if (this.tester != null) {
            this.tester.destroy();
        }
    }

It runs my test case within 2 seconds  compare to 25 seconds for this below 
    @Before
    public void setup() {
            this.authenticatedWebApp = new AuthenticatedTestApplication();
            this.tester = new WicketTester(this.authenticatedWebApp);
    }

   @After
    public void tearDown() {
        this.tester = null;
         this.authenticatedWebApp = null;
    }




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-18-Performance-of-unit-test-observation-tp3756900p3756900.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket 1.4.18: Performance of unit test observation.

Posted by Bruno Borges <br...@gmail.com>.
Oh... sorry Igor... :-)

*Bruno Borges*
(21) 7672-7099
*www.brunoborges.com*



On Sat, Aug 20, 2011 at 2:20 PM, Bruno Borges <br...@gmail.com>wrote:

> Not exactly...
>
> JUnit calls @Before and @After for each test method. That's why...
>
>
> *Bruno Borges*
> (21) 7672-7099
> *www.brunoborges.com*
>
>
>
> On Sat, Aug 20, 2011 at 1:59 PM, Igor Vaynberg <ig...@gmail.com>wrote:
>
>> When you reuse the application instance across tests you are also reusing
>> its caches.
>>
>> -igor
>> On Aug 20, 2011 4:03 AM, "cablepuff" <ca...@gmail.com> wrote:
>> > Hi can someone explain to me why performance of unit testing is faster
>> using
>> > setUp and destory this way.
>> >
>> > @Before
>> > public void setup() {
>> > if (this.authenticatedWebApp == null) {
>> > this.authenticatedWebApp = new AuthenticatedTestApplication();
>> > }
>> > if (this.tester == null) {
>> > this.tester = new WicketTester(this.authenticatedWebApp);
>> > }
>> > else {
>> > this.tester.setupRequestAndResponse(true);
>> > }
>> > }
>> >
>> > @After
>> > public void tearDown() {
>> > if (this.tester != null) {
>> > this.tester.destroy();
>> > }
>> > }
>> >
>> > It runs my test case within 2 seconds compare to 25 seconds for this
>> below
>>
>> > @Before
>> > public void setup() {
>> > this.authenticatedWebApp = new AuthenticatedTestApplication();
>> > this.tester = new WicketTester(this.authenticatedWebApp);
>> > }
>> >
>> > @After
>> > public void tearDown() {
>> > this.tester = null;
>> > this.authenticatedWebApp = null;
>> > }
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>>
>> http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-18-Performance-of-unit-test-observation-tp3756900p3756900.html
>> > Sent from the Users forum mailing list archive at Nabble.com.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>>
>
>

Re: Wicket 1.4.18: Performance of unit test observation.

Posted by Bruno Borges <br...@gmail.com>.
Not exactly...

JUnit calls @Before and @After for each test method. That's why...


*Bruno Borges*
(21) 7672-7099
*www.brunoborges.com*



On Sat, Aug 20, 2011 at 1:59 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> When you reuse the application instance across tests you are also reusing
> its caches.
>
> -igor
> On Aug 20, 2011 4:03 AM, "cablepuff" <ca...@gmail.com> wrote:
> > Hi can someone explain to me why performance of unit testing is faster
> using
> > setUp and destory this way.
> >
> > @Before
> > public void setup() {
> > if (this.authenticatedWebApp == null) {
> > this.authenticatedWebApp = new AuthenticatedTestApplication();
> > }
> > if (this.tester == null) {
> > this.tester = new WicketTester(this.authenticatedWebApp);
> > }
> > else {
> > this.tester.setupRequestAndResponse(true);
> > }
> > }
> >
> > @After
> > public void tearDown() {
> > if (this.tester != null) {
> > this.tester.destroy();
> > }
> > }
> >
> > It runs my test case within 2 seconds compare to 25 seconds for this
> below
>
> > @Before
> > public void setup() {
> > this.authenticatedWebApp = new AuthenticatedTestApplication();
> > this.tester = new WicketTester(this.authenticatedWebApp);
> > }
> >
> > @After
> > public void tearDown() {
> > this.tester = null;
> > this.authenticatedWebApp = null;
> > }
> >
> >
> >
> >
> > --
> > View this message in context:
>
> http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-18-Performance-of-unit-test-observation-tp3756900p3756900.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>

Re: Wicket 1.4.18: Performance of unit test observation.

Posted by Igor Vaynberg <ig...@gmail.com>.
When you reuse the application instance across tests you are also reusing
its caches.

-igor
On Aug 20, 2011 4:03 AM, "cablepuff" <ca...@gmail.com> wrote:
> Hi can someone explain to me why performance of unit testing is faster
using
> setUp and destory this way.
>
> @Before
> public void setup() {
> if (this.authenticatedWebApp == null) {
> this.authenticatedWebApp = new AuthenticatedTestApplication();
> }
> if (this.tester == null) {
> this.tester = new WicketTester(this.authenticatedWebApp);
> }
> else {
> this.tester.setupRequestAndResponse(true);
> }
> }
>
> @After
> public void tearDown() {
> if (this.tester != null) {
> this.tester.destroy();
> }
> }
>
> It runs my test case within 2 seconds compare to 25 seconds for this below

> @Before
> public void setup() {
> this.authenticatedWebApp = new AuthenticatedTestApplication();
> this.tester = new WicketTester(this.authenticatedWebApp);
> }
>
> @After
> public void tearDown() {
> this.tester = null;
> this.authenticatedWebApp = null;
> }
>
>
>
>
> --
> View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-18-Performance-of-unit-test-observation-tp3756900p3756900.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>