TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

JUnit

Create JUnit Test Suite in Eclipse

Introduction

In this post, we will see how to create JUnit Test Suite in Eclipse. If we have several test classes, we can combine them into a single test suite. Running a test suite executes all test classes in the suite in the specified order. A test suite may also contain other test suites.

Create Test Suite

Let us see how to create a  suite using Eclipse. Right-click in the Project Explorer where you have JUnit test cases. Select New –> Other…​ ->  JUnit ->  JUnit Test Suite.

Select the test classes which should be included in the Suite in the wizard window. We can select the test classes with JUnit test methods as shown in the below picture.

 

 

JUnit_Test_Suite

 

Hit on the finish button and look how the test suite is created with all the selected test classes.

Code Listing

 

@RunWith(Suite.class)
@SuiteClasses({ SampleTestExample.class, TestOrderExample.class })

public class AllTests {

}

 

When a class is annotated with @RunWith or extends a class annotated with @RunWith, JUnit will invoke the class it references to run the tests in that class instead of the runner built into JUnit. The above code example shows the basic usage of a  Suite.

Screenshot

We can see below, that all the test classes have run which are added to the Suite.

JUnit_RunWith

 

JUnit Tutorial on this website can be found at:

https://www.testingdocs.com/junit-tutorial/

More information on JUnit official website:

https://junit.org

 

Related Posts

Getting Started with JUnit Framework

JUnit /

Getting Started with JUnit Framework

Run JUnit tests from command line

JUnit /

Run JUnit tests from command line

Working with JUnit in Eclipse IDE

JUnit /

Working with JUnit in Eclipse IDE

Adding JUnit5 library to a Project

JUnit /

Adding JUnit5 library to a Project

Test Failure JUnit

JUnit /

Debug JUnit Tests using IDE

‹ JUnit @RunWith Annotation› Assumptions in JUnit Tests

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version