How to pass input from command line to junit maven test program

Passing the numbers as system properties like suggested by @artbristol is a good idea, but I found that it is not always guaranteed that these properties will be propagated to the test.

To be sure to pass the system properties to the test use the maven surefire plugin argLine parameter, like

mvn -Dtest=AddNumbers -DargLine="-Dnum1=1 -Dnum2=2"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)