简体   繁体   中英

how to import a web application on a junit java project

i wrote few test cases using junit and mockito for a web application, while writing test cases , i gave dependency on build path as one other project which is a dynamic web application. now i have written all test cases using mocking and junit , but don't know how to give that web application as dependency to my junit project now when i have to deploy it , eclipse can have dependent project on build path it worked like that but how can we do that outside of any IDE , specially web application.

Thanks.

Run your tests inside your web project. Define another source package like '/src/test/' and put them there. Then modify your ant script:

  • run these tests on build or test
  • exclude this source package on war.

Alternative extract common classes, which both projects are using, and create a new project jar. Then import this new jar on both projects as dependency.

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