Results 1 to 2 of 2
  1. #1
    NoobieCode is offline Senior Member
    Join Date
    Mar 2013
    Posts
    123
    Rep Power
    0

    Default Java Testing (Junit - general question)

    Hello. If I have a project and it contains one package and inside that one package contains 2 packages, say, one package is named foobar (for Junit tests) and the other is named fooby (for some class). I want to test my methods in the foobar package. What exactly do I need to import into my foobar package in order to be able to use methods in the classes of my fooby package?

    Thanks for your help

  2. #2
    jashburn is offline Senior Member
    Join Date
    Feb 2014
    Posts
    219
    Rep Power
    1

    Default Re: Java Testing (Junit - general question)

    Hi. By "package", are you referring to Java package? If so, the same Java access and visibility rules apply to your unit test classes under the foobar package, i.e., you'll need to import the fooby package in your unit test classes.

    That said, you'd want to take a look at java - Eclipse junit testing in the same project - Stack Overflow and java - Organization of JUnit tests in projects - Stack Overflow for a discussion on the way to organise your "normal" and JUnit test code. I belong to the camp that advocates having a separate "test" source folder that contains a package structure that is exactly the same as the "normal" source code package structure.

Similar Threads

  1. junit exception testing
    By NoobieCode in forum New To Java
    Replies: 3
    Last Post: 10-10-2013, 11:06 AM
  2. Junit Testing within local classes
    By danboy4 in forum New To Java
    Replies: 3
    Last Post: 10-08-2012, 02:44 PM
  3. Junit testing, testing list<e> interface
    By mackavelirip in forum New To Java
    Replies: 0
    Last Post: 10-05-2011, 07:08 AM
  4. JUnit testing
    By hedonist in forum Advanced Java
    Replies: 4
    Last Post: 10-04-2009, 01:06 PM
  5. Testing JUnit PDE with Ant
    By keynan in forum Eclipse
    Replies: 0
    Last Post: 02-15-2008, 12:35 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •