Vivek
Vivek

Reputation: 660

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.

Upvotes: 0

Views: 761

Answers (1)

Vassilis Blazos
Vassilis Blazos

Reputation: 1610

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.

Upvotes: 1

Related Questions