Wicket 1.4.18: Performance of unit test observation.

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

Wicket 1.4.18: Performance of unit test observation.

cablepuff
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;
    }


Reply | Threaded
Open this post in threaded view
|

Re: Wicket 1.4.18: Performance of unit test observation.

Igor Vaynberg-2
When you reuse the application instance across tests you are also reusing
its caches.

-igor
On Aug 20, 2011 4:03 AM, "cablepuff" <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Re: Wicket 1.4.18: Performance of unit test observation.

Bruno Borges
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 <[hidden email]>wrote:

> When you reuse the application instance across tests you are also reusing
> its caches.
>
> -igor
> On Aug 20, 2011 4:03 AM, "cablepuff" <[hidden email]> 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: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Wicket 1.4.18: Performance of unit test observation.

Bruno Borges
Oh... sorry Igor... :-)

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



On Sat, Aug 20, 2011 at 2:20 PM, Bruno Borges <[hidden email]>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 <[hidden email]>wrote:
>
>> When you reuse the application instance across tests you are also reusing
>> its caches.
>>
>> -igor
>> On Aug 20, 2011 4:03 AM, "cablepuff" <[hidden email]> 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: [hidden email]
>> > For additional commands, e-mail: [hidden email]
>> >
>>
>
>