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 7248705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:10:29+00:00 2026-05-28T22:10:29+00:00

I have organised my junit tests using one inner class per method as described:

  • 0

I have organised my junit tests using one inner class per method as described:

Here, in a haacked article (about nunit testing), and
Here, in this SO question

public class TestMyThing {

    public static class TestMyThingMethodOne {

        @Test
        public void testMethodOneDoesACertainBehaviour() {
            // terse, clear testing code goes here
        }

        @Test
        public void testMethodOneHasSomeOtherDesiredBehaviour() {
            // more inspiring testing code here
        }
    }

    public static class TestMyThingMethodTwo {
        ... etc
    }
}

However, when I try to run the junit tests for this, Eclipse asks me which of the inner class tests I want to run and I can only choose one. Is there a way I can specify that I want every test in every inner class for the TestMyThing class to run?

  • 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-28T22:10:30+00:00Added an answer on May 28, 2026 at 10:10 pm

    I asked my question on the Eclipse forum in this post and it turns out that it is possible for Eclipse to run all the inner classes. I quote the reply, which I’ve tried and can confirm that it works great (i.e. I can call all of the tests in my inner classes with one command):

    JUnit 4 comes with a runner class called Enclosed, which does what you need.

    Annotate the outer class with
    @RunWith(Enclosed.class)
    with Enclosed =
    import org.junit.experimental.runners.Enclosed;

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

Sidebar

Related Questions

I have a C++ class representing a hierarchically organised data tree which is very
I have recently re-organised our source control and found one of our solutions no
i have just begun experimenting on using table layout panel to keep things organised.
So I have a Tree<E> class where E is the datatype held and organized
I have panel that is using group layout to organize some label. I want
I have some pages organised like this: http://localhost/index.html http://localhost/download.html http://localhost/contact.html And I need them
I have a .NET solution which was badly organised, so I moved some projects
I've done a large study into using MVC and thanks to the people here
I have code similar to the following in one of my jinja template {%
I have been looking at nestedSet behaviour in symfony using doctrine, to display a

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.