Issue Details (XML | Word | Printable)

Key: APF-478
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Matt Raible
Reporter: Matt Raible
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
AppFuse

Make test base classes available to dependent projects

Created: 26/Oct/06 02:31 PM   Updated: 30/Dec/06 01:17 AM   Resolved: 18/Nov/06 04:50 PM
Component/s: Build, Test, or Deploy Process, Installation
Affects Version/s: 2.0-M2
Fix Version/s: 2.0-M2


 Description  « Hide
From the user list:

I'm interested in the compiled version of test package with appfuse test
implementation classes like "BaseDaoTestCase". Then it'll be possible to
depend my version of test module on the appfuse test module with test
specific implementation classes appfuse provide. This is because I'm not
using appfuse implementation classes directly for future compatibility
reasons.

Tuncay Altun added a comment - 27/Oct/06 08:28 AM
Nice :-)

Thx

Bryan Noll added a comment - 31/Oct/06 04:10 PM
Simply add the following to the pom of any module that has test-classes that you want jarred up. For example, when added to 'appfuse/data/hibernate/pom.xml', you'll get a jar named 'appfuse-hibernate-2.0-SNAPSHOT-tests.jar' in the target directory.

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Matt Raible made changes - 01/Nov/06 12:21 AM
Field Original Value New Value
Status Open [ 1 ] In Progress [ 3 ]
Matt Raible made changes - 01/Nov/06 05:55 PM
Status In Progress [ 3 ] Open [ 1 ]
Matt Raible added a comment - 01/Nov/06 06:01 PM
I was going to simply move BaseDaoTestCase (and others) into the "src/main/java" folder for each module. However, to do this, it requires that spring-mock and junit become "compile" dependencies rather than "test" dependencies. Doesn't seem very clean. The only alternative I can think of is to create a "test" module that contains the base classes for each module. Unfortunately, the Base*TestCase classes in the "web" module depend on a lot of web-framework-specific classes and it might get ugly with the dependencies. I'm open to suggestions.

Matt Raible added a comment - 18/Nov/06 12:25 PM
Advise from the Maven list:

http://www.nabble.com/How-do-I-include-base-tests-classes-in-main-JAR-tf2660727s177.html#a7421873

Option 1: Include Base*TestCase in sources and make any dependencies it requires optional
Option 2: Use "test-jar" as Bryan suggested and include it in distribution and archetypes.

I like #1.

Tuncay Altun added a comment - 18/Nov/06 01:40 PM
Hi,

I better like the option 2. This is because the Appfuse as a framework will preserve the way of Maven package structure which breaks a project into "modules" e.g. a standard directories for "test" and "source" instead of mixing altogether.

It should be optional whether a user will depend on test source for a given module or not and each module should have it's own test-xxx-.jar.

Sounds like a lot of requirements without a solution to them whether it fits to appfuse or not :-) but I think it will be more flexible in future if it could preserve the modularized way. There should be a solution and right now I'm not so creative but I will soon discuse this with my colleagues.

// Tuncay Altun

2048 by  Matt Raible (24 files)
18/Nov/06 03:55 PM (44 months, 20 days ago)
APF-478: Made test base classes available to dependent projects
appfuse: trunk/service/src/main/java/org/appfuse/service/BaseManagerTestCase.java 2048 history download (+61) new
appfuse: trunk/service/pom.xml 2048 history download (+1 -1) diffs
appfuse: trunk/web/tapestry/src/test/java/org/appfuse/webapp/action/MockPageService.java 2048 history deleted
appfuse: trunk/archetypes/appfuse-archetype-basic/src/main/resources/archetype-resources/pom.xml 2048 history download (+52 -0) diffs
appfuse: trunk/web/jsf/pom.xml 2048 history download (+24 -20) diffs
appfuse: trunk/web/tapestry/src/test/java/org/appfuse/webapp/action/MockRequestCycle.java 2048 history deleted
appfuse: trunk/web/jsf/src/main/java/org/appfuse/webapp/action/BasePageTestCase.java 2048 history download (+97) new
appfuse: trunk/web/struts/src/main/java/org/appfuse/webapp/action/BaseActionTestCase.java 2048 history download (+55) new
appfuse: trunk/data/ibatis/src/test/java/org/appfuse/dao/BaseDaoTestCase.java 2048 history deleted
appfuse: trunk/pom.xml 2048 history download (+2 -2) diffs
appfuse: trunk/web/spring/src/test/java/org/appfuse/webapp/action/BaseControllerTestCase.java 2048 history deleted
appfuse: trunk/web/spring/src/main/java/org/appfuse/webapp/action/BaseControllerTestCase.java 2048 history download (+123) new
appfuse: trunk/web/tapestry/src/main/java/org/appfuse/webapp/action/MockRequestCycle.java 2048 history download (+53) new
appfuse: trunk/data/ibatis/src/main/java/org/appfuse/dao/BaseDaoTestCase.java 2048 history download (+60) new
appfuse: trunk/data/hibernate/src/test/java/org/appfuse/dao/BaseDaoTestCase.java 2048 history deleted
appfuse: trunk/web/struts/src/test/java/org/appfuse/webapp/action/BaseActionTestCase.java 2048 history deleted
appfuse: trunk/service/src/test/java/org/appfuse/service/BaseManagerTestCase.java 2048 history deleted
appfuse: trunk/data/hibernate/src/main/java/org/appfuse/dao/BaseDaoTestCase.java 2048 history download (+60) new
appfuse: trunk/web/jsf/src/test/java/org/appfuse/webapp/action/BasePageTestCase.java 2048 history deleted
appfuse: trunk/web/tapestry/src/main/java/org/appfuse/webapp/action/MockPageService.java 2048 history download (+12) new
appfuse: trunk/web/tapestry/src/main/java/org/appfuse/webapp/action/BasePageTestCase.java 2048 history download (+69) new
appfuse: trunk/web/tapestry/src/test/java/org/appfuse/webapp/action/BasePageTestCase.java 2048 history deleted
appfuse: trunk/service/src/test/java/org/appfuse/service/impl/BaseManagerTestCase.java 2048 history deleted
appfuse: trunk/service/src/main/java/org/appfuse/service/impl/BaseManagerTestCase.java 2048 history download (+53) new

Matt Raible added a comment - 18/Nov/06 04:50 PM
I went with option #1 for now - will refactor to #2 if a patch is provided and it proves to be a cleaner solution. ;-)

Matt Raible made changes - 18/Nov/06 04:50 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Tuncay Altun added a comment - 19/Nov/06 06:34 AM
Nice for now, I hope some other or my team will find a better solution in future.

Good luck !

//tua

Matt Raible added a comment - 30/Dec/06 01:17 AM
This isn't quite as clean as I'd like it to be since users have to declare any testing frameworks they want to use in their pom.xml.

Options:

1. Keep the current setup and require users to declare junit, jmock, spring-mock, etc. for writing tests.
2. Try using the test-jar setup as described at http://maven.apache.org/guides/mini/guide-attached-tests.html.
3. Create a separate test module that has all its dependencies optional (so users don't get Struts sucked in on a JSF project and such). Make the standard testing frameworks part of the compile phase so they get sucked in.

#3 seems like the most work from a project perspective and somewhat unclean from a code-organization perspective. Are we going to write tests for these tests? ;-) However, it would allow end users to get all the test dependencies by including appfuse-test (or something like that) in their dependencies.

Thoughts? I'd like to get this resolved before the M1 release (hopefully w/in the next week or so).