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

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com