Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6536321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:28:44+00:00 2026-05-25T10:28:44+00:00

I am a long time user of Eclipse but a novice when it comes

  • 0

I am a long time user of Eclipse but a novice when it comes to JUnit. I have lots of java projects and I want to start writing test cases around the methods in those projects. I’m just wondering the best way to set up the Eclipse environment for this purpose. Let’s assume I have a typical project with a typical src directory in a specified package. How do I attach test cases to that project. Some concerns:
1. I don’t want the test cases to be part of any build that I create on the project.
2. I want to refer to the clases in the test-suite.

Do I set up a separate test directory under the package I want to test? Do I have a separate test package? What is the best way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:28:45+00:00Added an answer on May 25, 2026 at 10:28 am

    It’s pretty dead simple:

    • Drag or otherwise place the JUnit jar file into your lib folder, then
      modify your projects build settings to include it.
    • Create another source folder under your project called ‘test’
    • Create your test packages underneath the ‘test’ source folder. Best
      practice is to mimic the package names of your application.
    • Create your test classes inside of the test packages. Best practices
      is to mimic your application classes that require testing, but append
      Test at the end of the name. So for example in your main application
      you might have a myapp.service.PrintService and as a corresponding
      test you would have myapp.service.PrintServiceTest
    • Extend each test class from junit.framework.TestCase
    • Run your test classes using TestRunner.

    When you build your application’s deployment bundle just exclude the ‘test’ source folder. Now, if you want really drop dead easy test integration then use Maven to setup your project. It bakes in all the best practices for you right off the bat.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am long time user of LINQ2SQL, but have not used the Entity Framework
I'm a long time Eclipse user but new to Git/Egit. Recently I've been trying
I'm a long time Crystal Report user but have finally decided to ditch it
I've been a long time user of the Make build system, but I have
I'm a long-time emacs user, and I'm now working about 1/2 time in Java.
I am a long time vim user and have heard great things about TextMate
I have been looking for the error for a long time, but cannot find
I have been a long time user of the standard Mac Terminal. Decided to
I'm a long-time eclipse user looking to use netbeans now that I've tried netbeans
I'm a long time user of the .NET Framework on Windows platforms, but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.