简体   繁体   中英

Is there any way to run the junit / TestNG test cases in test environment?

I am new to the spring framework. I have some experience in rails framework.

I am planing to create 3 environment ( test, dev, production )

I have created profiles in my pom file for each of this environment,

If i want to change the environment i have to manually change the active status as true / false.

Once i changed the environment, my entire app is running in that environment.

My question is,

"Is there any way to run the junit / TestNG test cases in test environment without changing anything in pom file?"

Thanks,

Jon

If you use maven profiles you can trigger them in several ways. The easiest thing for you seems to explicitly specified the profile using the -P command line option.

mvn -P [test|dev|production]

Beside that, Spring 3.1 will introduce XML Profiles - this can be a good way how you can work with different environments. It should be released this year - although they have already a delay in releasing the RC1. Nevertheless I would give the Milestone release a try (I already did).

(Parts of this answer comes from here )

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