AndHow! Java Configuration .
  • AndHow!
  • Live-Code Quickstart
  • Simple Usage Examples
  • User Guide
    • Key Concepts
    • AndHow Properties
    • Loaders & Load Order
    • Testing
    • AndHow Initialization
    • Configuring AndHow
    • Whitespace Handling
    • Integration and Exports
    • Changing the Load Order
    • Java9 and Above
    • Best Practices
  • Developer Guide
    • How to Contribute
    • First Checkout with Git
    • Project Branching Structure
    • New Workstation Setup
    • Background
    • Framework Testing
    • Conventions
    • Release Plan
    • HowTo Release
    • Troubleshooting
    • References
  • Help / Questions
  • Release Notes
    • Release 0.4.2
  • FAQs
  • Other
    • JUnit Extension Registration
Powered by GitBook
On this page

Was this helpful?

FAQs

Frequently Asked Questions

How do I pass property values as system properties from command line to tests run via Maven?

Maven adds an extra layer between the command line and the tests themselves. Two common plugins are used to run tests within Maven: maven-failsafe-plugin for integration tests and maven-surefire-plugin for unit tests. Both pass parameters the same way from command line:

mvn clean verify -DargLine="-DMyPropertyName=MyPropertyValue"

mvn clean verify instructs Maven to create a fresh build, run units tests (surefire), run integration tests (failsafe) and verify the tests passed.

-DargLine="-DMyPropertyName=MyPropertyValue" sets a System Property named argLine, instructing both plugins to include -DMyPropertyName=MyPropertyValue in the command when they invoke a new process to run the tests, resulting in passing system properties to those tests. Quotes are needed if there are any spaces.

PreviousRelease 0.4.2NextOther

Last updated 3 years ago

Was this helpful?