简体   繁体   中英

How do I create run configurations for running junit tests via maven?

I have an app in which the junit tests should be run via a maven command like this :

mvn test -Dtest=MyCodeTestClassJavaName -Dbase_url=https://myapp-test-environment.com

I can run this via commandline, but I cannot do it in eclipse. Could someone please show me how to do it in eclipse ?

Thanks !

You need to pass "test" and "base_url" as environment variables in Eclipse. Here's docs how to do it.

在此处输入图片说明

I tried it myself and made it work. Here is the answer :

1 - Create a maven build configuration. Refer the image. 在此处输入图片说明

2 - Base directory = your project root.

3 - Goal = test

4 - Add the parameters in your maven command, that is :

test = MyCodeTestClassJavaName
base_url = https://myapp-test-environment.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM