File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven: Why is my test ignoring ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven: Why is my test ignoring ?" Watch "Maven: Why is my test ignoring ?" New topic

Maven: Why is my test ignoring ?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436

I'm using Maven 1.1 and running some unit tests. I am testing a web service that requires a username and password for access. So I can run my test like so (from within my test directory):

maven -Dtest.service.username=username -Dtest.service.password=password -Dtestcase=myco.dor.dmv.driver.matching.test.MatchingServiceTest -Dhttp.nonProxyHosts=localhost test:single

However, if I try and put the command line properties (e.g. test.service.username) into my file and run

maven -Dtestcase=myco.dor.dmv.driver.matching.test.MatchingServiceTest -Dhttp.nonProxyHosts=localhost test:single

my test dies with the output below. How can I specify these proeprties in a file? Thanks, - Dave

<error message="Username may not be null" type="java.lang.IllegalArgumentException">java.lang.IllegalArgumentException: Username may not be null
at org.apache.commons.httpclient.UsernamePasswordCredentials.<init>(
at org.apache.axis2.transport.http.AbstractHTTPSender.setAuthenticationInfo(
at org.apache.axis2.transport.http.AbstractHTTPSender.getHostConfiguration(
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(
at org.apache.axis2.transport.http.HTTPSender.send(
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
at org.apache.axis2.engine.AxisEngine.send(
at org.apache.axis2.description.OutInAxisOperationClient.send(
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(
at org.apache.axis2.client.OperationClient.execute(
at myco.dor.dmv.driver.matching.soap.MatchingServiceStub.verifyAge(
at myco.dor.dmv.driver.matching.test.MatchingServiceTest.testVerifyAgeOver18(
at org.apache.commons.jelly.tags.ant.AntTag.doTag(
at org.apache.commons.jelly.TagSupport.invokeBody(
at org.apache.commons.jelly.tags.core.OtherwiseTag.doTag(
at org.apache.commons.jelly.TagSupport.invokeBody(
at org.apache.commons.jelly.tags.core.ChooseTag.doTag(
at org.apache.commons.jelly.TagSupport.invokeBody(
at org.apache.commons.jelly.tags.core.IfTag.doTag(
at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(
at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(
at org.apache.maven.werkz.Goal.attain(
at org.apache.maven.plugin.PluginManager.attainGoals(
at org.apache.maven.MavenSession.attainGoals(
at org.apache.maven.cli.App.doMain(
at org.apache.maven.cli.App.main(
at com.werken.forehead.Forehead.main(

manuel aldana
Ranch Hand

Joined: Dec 29, 2005
Posts: 308
i guess you meant maven version 2.1?

1) if you pass to maven command you pass it to the maven run itself. to passthrough the stuff to the surefire plugin you have to configure the surefireplugin. see

2) you should reconsider passing property arguments to the as maven run property. first you (and your colleages) get quickly confused if more and more properties are added. better practice is either to code it directly in your test class or use src/test/resources to place property files there.

aldana software engineering blog & .more
I agree. Here's the link:
subject: Maven: Why is my test ignoring ?
It's not a secret anymore!