arin
arin

Reputation: 125

Pass user name while running test using maven command

We would like to create test report specific to user who fired the request in the server. If we change pom this way

<configuration>
    <outputDirectory>${basedir}/target/${user.name}</outputDirectory>
</configuration>


This produces the user name of the server, not the individual who fired the test. I have seen one possible solution like mvn surefire-report:report -DoutputDirectory=newpath. But wondering, how can we pass the user name through command prompt.


Any guidance would be very much appreciated.

Upvotes: 1

Views: 471

Answers (1)

maba
maba

Reputation: 48095

Create a property in your pom file:

<pom>
    ...
    <properties>
        <some.propertyName></some.propertyName>
    </properties>
    ...
    <configuration>
        <outputDirectory>${basedir}/target/${some.propertyName}</outputDirectory>
    </configuration>
</pom>

Then you use it like this:

mvn surefire-report:report -Dsome.propertyName=DonaldDuck

Upvotes: 1

Related Questions