[shrinkwrap-issues] [JBoss JIRA] (SHRINKDESC-89) Improve test code readability by introducing assertion DSL

Michal Matloka (JIRA) jira-events at lists.jboss.org
Fri Dec 21 16:51:08 EST 2012


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

Michal Matloka reassigned SHRINKDESC-89:
----------------------------------------

    Assignee: Michal Matloka  (was: Bartosz Majsak)

    
> Improve test code readability by introducing assertion DSL
> ----------------------------------------------------------
>
>                 Key: SHRINKDESC-89
>                 URL: https://issues.jboss.org/browse/SHRINKDESC-89
>             Project: ShrinkWrap Descriptors
>          Issue Type: Task
>          Components: test
>    Affects Versions: 1.1.0-alpha-5
>            Reporter: Bartosz Majsak
>            Assignee: Michal Matloka
>            Priority: Optional
>              Labels: testing
>
> Improving tests assertion might bring few benefits for us, such as:
> * more concise tests focused on the functionality
> * better readability and understanding of the tests (and the way how our tool works in general [which might be really handy for newcomers]), also by using domain-specific assertions
> * easier maintenance
> For instance for Node assertions we could have:
> {code}
> assertThat(root.getChildren()).containsOnly(CHILD_1, CHILD_2)
> {code}
> or even something more fancy
> {code}
> assertThat(node).isAccessibleFrom(otherNode)
> {code}
> Two options worth considering are:
> * [Hamcrest|http://code.google.com/p/hamcrest/] (bundled with JUnit as of 4.4)
> * [FEST-Assert|http://docs.codehaus.org/display/FEST/Fluent+Assertions+Module]
> I would rather go with the latter. Its' fluent interface DSL is somehow easier to use in tests.
> When it comes to dependencies, here's the full list:
> {code}
> org.easytesting:fest-assert:jar:1.3 
>     org.easytesting:fest-util:jar:1.1.4 (compile) 
>     org.easytesting:fest-reflect:jar:1.2 (test) 
>     org.easytesting:fest-test:jar:1.2.1 (test) 
>         junit:junit:jar:4.7 (test) 
>     org.easytesting:fest-mocks:jar:1.1.1 (test) 
>         org.easymock:easymockclassextension:jar:2.4 (test) 
>             org.easymock:easymock:jar:2.4 (test) 
>             cglib:cglib-nodep:jar:2.1_3 (test) 
>         org.easymock:easymock:jar:2.4 (test) 
>     junit:junit:jar:4.7 (test) 
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the shrinkwrap-issues mailing list