You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Naming your Test

In the past, tests were numbered sequentially (it001,it002, etc). This becomes problematic because it's not always obvious what the issue is related to the test. More importantly, it's hard to create and submit sequential tests via patches because non-committers have no way to reserve the next number. This leads to extra work to apply the patch.

 New tests should be named using the Jira Issue id along with a meaningful name. This name should typically be the subject of the issue or a subset. It should be informative of the issue but not excessively long. Therefore a good name would be: mng1234-groupIdOrderIsBackwards.

This name is typically used in several places of the test: the folder in core-integration-tests/src/test/resources/ that contains the sample project along with the name of the junit class used to invoke the sample project and check the results.

Sample IT Project

A sample project has been created to aid in IT test creation. It can be retrieved using svn hereor viewed with your browser here.

Sample IT Archetype 

This project has also been converted into an archetype to make it even easier to use. (NOTE: This is currently not deployed and bugs prevent this from being usable right now. Use the Sample IT project for now and skip this section -Brianf 8/8/07)

Using ArchetypeNG To create a sample from the archetype

It would be helpful to review the archetypeNG plugin tutorial here: [insert url of site when it lands at apache] 

The maven-archetypeng-plugin is currently a snapshot. You will need to add the snapshot repository to your settings to be able to retreive the plugin and the archetype (when it gets deployed).

<settings>
...
  <profiles>
    <profile>
       <id>maven-snapshots</id>
       <repositories>
         <repository>
           <id>Maven Snapshots</id>
	   <url>http://people.apache.org/repo/m2-snapshot-repository</url>
	   <snapshots>
	     <enabled>true</enabled>
	   </snapshots>
	   <releases>
	     <enabled>false</enabled>
            </releases>
	</repository>
      <repositories>
    <profile>
  <profiles>
  <!--need to activate my profile unless I want to type 'mvn -Pmaven-snapshots' all the time-->
  <activeProfiles>
     <activeProfile>maven-snapshots</activeProfile>
   </activeProfiles>
</settings>

The archetypeNG plugin maintains a list of known archetype groups for interactive prompting. The next step is to add the IT group:

ARCHETYPE-82: You must manually create archetype.xml in your $HOME/.m2 folder and it must minimally contain the following:

<?xml version="1.0" encoding="UTF-8"?><archetype-registry>
  <ArchetypeGroups>
    <ArchetypeGroup>org.apache.maven.archetypes</ArchetypeGroup>
    <ArchetypeGroup>org.codehaus.mojo.archetypes</ArchetypeGroup>
    <ArchetypeGroup>org.apache.maven.it.sample</ArchetypeGroup>
  </ArchetypeGroups>
  <ArchetypeRepositories>
    <ArchetypeRepository id="central">
      <url>http://repo1.maven.org/maven2</url>
    </ArchetypeRepository>
  </ArchetypeRepositories>
  <Languages>
    <Language>java</Language>
    <Language>groovy</Language>
    <Language>csharp</Language>
    <Language>aspectj</Language>
  </Languages>
  <FilteredExtensions>
    <FilteredExtension>java</FilteredExtension>
    <FilteredExtension>xml</FilteredExtension>
    <FilteredExtension>txt</FilteredExtension>
    <FilteredExtension>groovy</FilteredExtension>
    <FilteredExtension>cs</FilteredExtension>
    <FilteredExtension>mdo</FilteredExtension>
    <FilteredExtension>aj</FilteredExtension>
    <FilteredExtension>jsp</FilteredExtension>
    <FilteredExtension>gsp</FilteredExtension>
    <FilteredExtension>vm</FilteredExtension>
    <FilteredExtension>html</FilteredExtension>
    <FilteredExtension>xhtml</FilteredExtension>
    <FilteredExtension>properties</FilteredExtension>
    <FilteredExtension>.classpath</FilteredExtension>
    <FilteredExtension>.project</FilteredExtension>
  </FilteredExtensions>
</archetype-registry>

mvn archetypeng:add-groups -Dgroups=org.apache.maven.its

Successful output:

E:\svn\Maven\atest>mvn archetypeng:add-groups -Dgroups=org.apache.maven.its
Using maven.home=c:\Program Files\maven2\bin\\..
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetypeng'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetypeng:add-groups] (aggregator-style)
[INFO] ----------------------------------------------------------------------------
[INFO] [archetypeng:add-groups]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Aug 08 21:58:57 EDT 2007
[INFO] Final Memory: 5M/10M
[INFO] ------------------------------------------------------------------------

Now you can create the archetype project:

mvn archetype:create 

ARCHETYPE-83: prevents us from continuing with this story...

How you should execute for integration test to validate

How to submit your integration test

When you will know your IT has been reviewed

When you will know your IT has been integrated

  • No labels