Saturday, May 16, 2009

Maven archetype for testng + selenium

Lately I have been working a lot on front end stuffs such as JBoss Portal and Richfaces although my preference has always been to work on back end. Well life is full of these conflicting choices, isn't it?

I write sample applications for these JBoss Web Interface projects and testing them are included as part of continuous integration testsuite. To help with automation and to give easier ramp up time for new team members, I created a maven archetype for writing test cases using TestNG and Selenium. I purposely decided not to add cargo stuff as most of time we have preconfigured application and web servers. To use this for your own project, here is what you need to do


mvn archetype:generate -DarchetypeGroupId=org.jboss.maven.archetypes -DarchetypeArtifactId=selenium-testng -DarchetypeVersion=1.0 -DgroupId=org.whatever.project -DartifactId=myproject -DarchetypeRepository=http://repository.jboss.org/maven2/


This has .classpath and .project for Eclipse/JBDS projects as well so you can import the generated project into Eclipse/JBDS and your project build path will automatically be set correctly. This was my first real foray into maven and I still think that maven needs to mature more in terms of usability. I hear good things about Maven 3 so I am looking forward to that.

No comments: