1

I have an EJB3.0 application which has a ejbModule folder and some packages inside it. Can you Please tell me how and where to add test cases to the project? Do I need to create a separate test project or is there any way where we can add test package inside the same existing project like maven creates one?

P.s. I'm not using maven here. I'm using eclipse.

I Have an update. Please find my project structure below.

EJB Project Structure

devvapp
  • 143
  • 1
  • 2
  • 9

2 Answers2

0

Create a separate folder, for example if your source code is in folder src/main/java create your tests under folder src/test/java. You test packages names should also have same package names like your java code.

Even though you don't use Maven, you could follow similar way.

enter image description here

Jay
  • 9,189
  • 12
  • 56
  • 96
0

You can add your test package in any place in your project. Just remember to have JUnit (or other testing library) added to project's build path.

Most common option is to create new folder in SampleEJB project using Eclipse (name it something like 'test'). Then right-click on that folder and choose Build Path -> Use as Source Folder. Inside this folder add normal java package. This is most common way, because you have clear separation between 'normal' classes and test classes - each in different project's source folder.

Tomasz Nowak
  • 221
  • 1
  • 8