[arquillian-issues] [JBoss JIRA] Updated: (ARQ-131) Include utility base class to simplify JPA testing

Paul Bakker (JIRA) jira-events at lists.jboss.org
Tue May 4 10:03:05 EDT 2010


     [ https://jira.jboss.org/jira/browse/ARQ-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Bakker updated ARQ-131:
----------------------------

    Attachment: AbstractJPATest.java
                RollbackAfterTest.java
                ContactBeanTest.java


The AbstractJPATest is an example implementation of a base class as described in the issue. ContactBeanTest is an example test based on the base class.

> Include utility base class to simplify JPA testing
> --------------------------------------------------
>
>                 Key: ARQ-131
>                 URL: https://jira.jboss.org/jira/browse/ARQ-131
>             Project: Arquillian
>          Issue Type: Feature Request
>          Components: Test Harness Integration
>            Reporter: Paul Bakker
>            Priority: Minor
>         Attachments: AbstractJPATest.java, ContactBeanTest.java, RollbackAfterTest.java
>
>
> Two things are often needed when testing JPA code:
> -1 Counting rows in a table
> -2 Rolling back the transaction after each test (to speed up test execution, while potentially dangerous)
> To simplify testing it would be good to have a set of base classes that implement this common functionality. Test class can extend a base class when this kind of functionality is required. The Spring framework has excellent support for this and can be used for inspiration:
> http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/testing.html#testcontext-support-classes-junit4
> I included some example code that I wrote myself to get a feel how difficult it would be to implement. The code uses an embedded container using the EJB 3.1 API, but should off course integrate with Arquillian. 
> By default each testcase runs in a transaction (using the usertransaction) and is rolled back at the end of the test, unless the testcase is annotated @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED). The rollback behavior can be changed with the custom @RollbackAfterTest anotation.
> I would be happy to help implementing this feature.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the arquillian-issues mailing list