You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Field <or...@cloudinthesky.co.uk> on 2009/06/19 00:38:51 UTC

[Announce] Tapestry Testify project

I'd like to announce that the Tapestry Testify project is now available as a
Snapshot release at Tapestry 360:
https://tapestry.formos.com/nightly/tapestry-testify/

Tapestry Testify is an extension to Tapestry that allows you to write page
and component tests very easily and have them run very efficiently.


** Features **

  Integration with JUnit3 , JUnit4 and TestNG 

  Per-test scope - define services that are re-created for each test

  Inject services into tests with the @Inject annotation

  Inject objects from the test into components with the @ForComponent
annotation

  Very efficient - allows a single PageTester to be used by all tests


Fedback is very welcome!

- Paul

---
Paul Field
http://creakingcogs.blogspot.com/


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


Re: [Announce] Tapestry Testify project

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Paul,

Cool, will try that out over the weekend, T5 really needs a easy to use
testing framework for pages and component, if can be used for TDD, that's
even better. will get back to you after I try it out, thanks and keep me
updated about Testify(the name sounds good!)

Angelo


Paul Field wrote:
> 
> Hi Angelo,
> 
>> definately a good addition, I tested only services now, I gave up the
>> PageTester, it's not practical to use it, and yet to learn that 
> Integrated
>> test, I have been looking for a way to test pages and components, will 
> give
>> your Testify, hope it will not be like PageTester:)
> 
> That's exactly why I wrote Testify. PageTester is good but it's slow to 
> create one (I was finding about 4secs for the first instances and about 
> 2secs for each other instance) and I was finding I needed different 
> instances for different tests - so my tests were taking ages to run. Also 
> it was very difficult to use mocks in the tests.
> 
> So Testify takes advantage of all the good infrastructure in PageTester 
> but makes it very fast because you can share one TapestryTester (which is 
> just a subclass of PageTester) amongst all your tests - so you just get a 
> one-off startup cost and then all the other tests are free.
> 
> I also added in facilities to make using Mocks very simple and that plus 
> the speed means it's practical to do lots of small-scale tests in the TDD 
> style.
> 
> Hopefully you'll find it's just what you were looking for :-)  And if not, 
> let me know the problem and I'll try to fix it.
> 
> Paul
> 
> ------------------
> Paul Field
> Research IT
> Deutsche Bank
> 
> 
> 
> ---
> 
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and delete this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
> 
> Please refer to http://www.db.com/en/content/eu_disclosures.htm for
> additional EU corporate and regulatory disclosures.
> 

-- 
View this message in context: http://www.nabble.com/-Announce--Tapestry-Testify-project-tp24102834p24110744.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: [Announce] Tapestry Testify project

Posted by Paul Field <pa...@db.com>.
Hi Angelo,

> definately a good addition, I tested only services now, I gave up the
> PageTester, it's not practical to use it, and yet to learn that 
Integrated
> test, I have been looking for a way to test pages and components, will 
give
> your Testify, hope it will not be like PageTester:)

That's exactly why I wrote Testify. PageTester is good but it's slow to 
create one (I was finding about 4secs for the first instances and about 
2secs for each other instance) and I was finding I needed different 
instances for different tests - so my tests were taking ages to run. Also 
it was very difficult to use mocks in the tests.

So Testify takes advantage of all the good infrastructure in PageTester 
but makes it very fast because you can share one TapestryTester (which is 
just a subclass of PageTester) amongst all your tests - so you just get a 
one-off startup cost and then all the other tests are free.

I also added in facilities to make using Mocks very simple and that plus 
the speed means it's practical to do lots of small-scale tests in the TDD 
style.

Hopefully you'll find it's just what you were looking for :-)  And if not, 
let me know the problem and I'll try to fix it.

Paul

------------------
Paul Field
Research IT
Deutsche Bank



---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.

Re: [Announce] Tapestry Testify project

Posted by Paul Field <pa...@db.com>.
> This looks really promising Paul, thanks!
> 
> One question, can Easymock be used for mocks, I am not familiar with 
Mockito?

Absolutely - Testify doesn't depend on Mockito.

BTW, do look at Mockito (http://mockito.org/) - it's a very clean way to 
write stubs and mocks - I used to be an EasyMock user and I've been 
converted :-)


So, some more information (which I will put into the documentation at some 
point) ....

My aim was just made sure that Testify would work well with Mockito's 
@Mock annotation so, if you use Mockito, it's *really* simple to create a 
mock and inject it into a component:

public class MyTest extends AbstractMyApplicationTest {
    @ForComponents @Mock MyService service;
 
    public void testElementIsOnPage() {
        when(service.shouldShowElement()).thenReturn(true);
        Document page = tester.renderPage("mypage");
        assertNotNull(page.getElementById("myid"));
    }

In this example, @ForComponents is a Testify annotation; @Mock is a 
Mockito annotation and AbstractMyApplicationTest is your own abstract test 
class that does standard setup:

public abstract class AbstractMyApplicationTest extends TapestryTest {
    private static final TapestryTester SHARED_TESTER
        = new TapestryTester("demo", MyCoreModule.class);

    public TestifyTest() {
        super(SHARED_TESTER);
    }
 
    @Override
    protected void setUpForAllTestClasses() throws Exception {
        MockitoAnnotations.initMocks(this);
    } 
}

Because this is *your* standard superclass, it's your choice to include 
other frameworks such as Mockito (or you could write your own equivalent 
of @Mock but for EasyMock and wire it in here).

-------------------------

However, if you wanted to use EasyMock, you'd setup the mocks yourself in 
your test. Something like this:

public class MyTest extends AbstractMyApplicationTest {
    @ForComponents MyService service;
 
    public void doSetUp() {
        service = EasyMock.createMock(MyService.class);
    }

    public void testElementIsOnPage() {
        expect(service.shouldShowElement()).andReturn(true);
        replay(service);
        Document page = tester.renderPage("mypage");
        assertNotNull(page.getElementById("myid"));
    }


And your standard superclass, obviously, doesn't set up Mockito:

public abstract class AbstractMyApplicationTest extends TapestryTest {
    private static final TapestryTester SHARED_TESTER
        = new TapestryTester("demo", MyCoreModule.class);

    public TestifyTest() {
        super(SHARED_TESTER);
    } 
}

------------------
Paul Field
Research IT
Deutsche Bank




---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.

Re: [Announce] Tapestry Testify project

Posted by Peter Stavrinides <P....@albourne.com>.
This looks really promising Paul, thanks!

One question, can Easymock be used for mocks, I am not familiar with Mockito?

cheers,
Peter

----- Original Message -----
From: "Angelo Chen" <an...@yahoo.com.hk>
To: users@tapestry.apache.org
Sent: Friday, 19 June, 2009 06:57:55 GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Re: [Announce] Tapestry Testify project


definately a good addition, I tested only services now, I gave up the
PageTester, it's not practical to use it, and yet to learn that Integrated
test, I have been looking for a way to test pages and components, will give
your Testify, hope it will not be like PageTester:)


Paul Field-3 wrote:
> 
> I'd like to announce that the Tapestry Testify project is now available as
> a
> Snapshot release at Tapestry 360:
> https://tapestry.formos.com/nightly/tapestry-testify/
> 
> Tapestry Testify is an extension to Tapestry that allows you to write page
> and component tests very easily and have them run very efficiently.
> 
> 
> ** Features **
> 
>   Integration with JUnit3 , JUnit4 and TestNG 
> 
>   Per-test scope - define services that are re-created for each test
> 
>   Inject services into tests with the @Inject annotation
> 
>   Inject objects from the test into components with the @ForComponent
> annotation
> 
>   Very efficient - allows a single PageTester to be used by all tests
> 
> 
> Fedback is very welcome!
> 
> - Paul
> 
> ---
> Paul Field
> http://creakingcogs.blogspot.com/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-Announce--Tapestry-Testify-project-tp24102834p24105144.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


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


Re: [Announce] Tapestry Testify project

Posted by Angelo Chen <an...@yahoo.com.hk>.
definately a good addition, I tested only services now, I gave up the
PageTester, it's not practical to use it, and yet to learn that Integrated
test, I have been looking for a way to test pages and components, will give
your Testify, hope it will not be like PageTester:)


Paul Field-3 wrote:
> 
> I'd like to announce that the Tapestry Testify project is now available as
> a
> Snapshot release at Tapestry 360:
> https://tapestry.formos.com/nightly/tapestry-testify/
> 
> Tapestry Testify is an extension to Tapestry that allows you to write page
> and component tests very easily and have them run very efficiently.
> 
> 
> ** Features **
> 
>   Integration with JUnit3 , JUnit4 and TestNG 
> 
>   Per-test scope - define services that are re-created for each test
> 
>   Inject services into tests with the @Inject annotation
> 
>   Inject objects from the test into components with the @ForComponent
> annotation
> 
>   Very efficient - allows a single PageTester to be used by all tests
> 
> 
> Fedback is very welcome!
> 
> - Paul
> 
> ---
> Paul Field
> http://creakingcogs.blogspot.com/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-Announce--Tapestry-Testify-project-tp24102834p24105144.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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