Question

Historically, I've always written my unit tests like this:

public void WidgetTest {
    @Test
    public void test_whatever() {
        // Given...

        // When...

        // Then...
    }
}

This allows me to right-click my test file in Eclipse and Run As >> JUnit, and test that 1 particular test, directly from inside Eclipse. Then, when doing a local (Ant-based) build, I configure a <junit> Ant task to run all of my src/test/java tests at once.

I'm now looking for an in-between solution. That is, a way to run all of my test classes from inside Eclipse, all at once, with the click of a button. A co-worker recommended that Junit has a notion of a "test suite" that I could attach all of my test classes to, but it looks like this test suite is some sort of JAR/tool that I don't want to include in my project.

So I ask: how can I define such a "test suite", consisting of all my test classes, and run all of them in one fell swoop, from inside Eclipse? Thanks in advance.

Was it helpful?

Solution

You can right click a project or package in Eclipse and choose to 'Run As->JUnit Test', to run all tests in that project or package. No need for a test suite unless you only want to run a subset of the tests.

OTHER TIPS

Have you tried to right-click your project and selecting and selecting Run as -> JUnit test? That runs all Unittests in the project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top