How to Fix No Tests Found for Given Includes Error in Test Frameworks?

On This Page What is the “ No Tests Found for Given Includes ” Error?April 01, 2026 · 7 min read · Testing Guide

How to Fix No Tests Found for Given Includes Error in Test Frameworks?

While working with exam frameworks, particularly, developers often face a lot of errors that delay the execution of their tests. One very common error substance is the “No Tests Found for Given Includes” fault. This error generally come when the test runner can ’ t identify or locate the tests free-base on the provided configuration.

Overview

Mutual Causes of & # 8220; No Tests Found for Given Includes & # 8221; Error

  • Missing or Improper Configuration in build.gradle
  • Incorrect Import of @ Test Annotation
  • Framework Version or Compatibility Mismatch
  • Issues with Gradle Test Execution
  • Misaligned Folder Structure Between Test and Source Directories

How to Solve the & # 8220; No Tests Found for Given Includes & # 8221; Error?

  • Update and Complete the build.gradle Configuration
  • Ensure the Correct Library is Used for @ Test Annotation Import
  • Use a JUnit 5-Compatible Library for Better Integration
  • Include the JUnit 5 Vintage Engine for Legacy Support
  • Manage Dependencies to Run JUnit 4 and JUnit 5 Tests Together
  • Execute Tests Using IntelliJ IDEA for Enhanced Compatibility
  • Align the Hierarchies of Your Test and Source Directories

In this article, learn more about the causes of this error and how to resolve it so that the development summons can be politic and effective.

What is the “ No Tests Found for Given Includes ” Error?

The “ No Tests Found for Given Includes ” fault occurs when the test contrabandist (like Gradle or IntelliJ IDEA) can not find or recognise the test methods mentioned in the project. This can be due to respective reasons, such ascontour issues, incorrect annotations, or mismatched addiction.

When this error comes, it mean that the tryout framework couldn ’ t locate any tests based on the standard or examination classes render. It usually indicates a misconfiguration or a setup matter that prevents the fabric from running the tests.

Read More:

What are the common causes of “ No Tests Found for Given Includes ” Error?

Multiple topic can lead to the “ No Tests Found for Given Includes ” error. Some of the common issues are:

1. Missing or Improper Configuration in build.gradle

In Gradle-based projects,build.gradlefile contains significant information about the location and running of the tests. If this file is not correctly configure or lacks significant dependencies, the test framework may miscarry to know or run the tests.

Read More:

2. Incorrect Import of @ Test Annotation

In JUnit-based labor, the @ Test annotation marks a method as a test. However, if the incorrect annotating is imported from a different library, such as JUnit 4 rather of JUnit 5, this can direct to conflicts and the error message “ No Tests Found for Given Includes ”.

3. Framework Version or Compatibility Mismatch

If the project uses a mix of different versions of the testing model (for example, JUnit 4 and JUnit 5), compatibility issues can prevent the trial from being agnize or executed properly. This version mismatch can trigger the fault.

4. Issues with Gradle Test Execution

Sometimes, test execution may neglect because of Gradle-specific issues such as incorrect task form or lose test performance background. This may prevent tests from being detected, leading to an mistake.

5. Misaligned Folder Structure Between Test and Source Directories

Test folders sometimes need a specific folder structure for source and examination files. If the directory are misalign (for instance, if your trial files are placed outside the standard src/test/java directory, the test moon-curser may not discover the tests, lead in an erroneousness.

Read More:

How to Solve the “ No Tests Found for Given Includes ” Error?

Here are some of the step to clear the “ No Tests Found for Given Includes ” error:

Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.

1. Update and Complete the build.gradle Configuration

Always ensure that build.gradle file bear all the necessary contour to run tests. For JUnit 5, include the JUnit dependency and test plugin. Here ’ s the example configuration:

dependence {testImplementation 'org.junit.jupiter: junit-jupiter-api:5.7.0' testImplementation 'org.junit.jupiter: junit-jupiter-engine:5.7.0'} test {useJUnitPlatform ()}

2. Ensure the Correct Library is Used for @ Test Annotation Import

Do check that the @ Test annotation is imported from the correct JUnit variation, so as to avoid any variety of fault.

For JUnit 5, importee it from:

signification org.junit.jupiter.api.Test;

For JUnit 4, signification it from:

significance org.junit.Test;

3. Use a JUnit 5 -Compatible Library for Better Integration

While using JUnit 5, it ’ s important to control that all the libraries are compatible. Using JUnit 5 libraries will raise the desegregation with modernistic creature and eliminate conflicts with legacy versions.

Read More:

4. Include the JUnit 5 Vintage Engine for Legacy Support

In order to run both JUnit 4 and JUnit 5 tests in the same project, include the JUnit 5 Vintage Engine to permit compatibility for JUnit 4 examination within a JUnit 5 environment. Add this dependency to build.gradle:

testImplementation 'org.junit.jupiter: junit-jupiter-engine:5.7.0' testImplementation 'org.junit.vintage: junit-vintage-engine:5.7.0 '

5. Manage Dependencies to Run JUnit 4 and JUnit 5 Tests Together

If test are run on both JUnit 4 and JUnit 5, ensure that the dependencies are in the build.gradle file is set up correctly to handle both:

testImplementation 'org.junit.jupiter: junit-jupiter-api:5.7.0' testImplementation 'org.junit.jupiter: junit-jupiter-engine:5.7.0' testImplementation 'org.junit.vintage: junit-vintage-engine:5.7.0 '

6. Execute Tests Using IntelliJ IDEA for Enhanced Compatibility

Sometimes, IDE-specific configurations may be causing the issue. Running trial directly from IntelliJ IDEA often resolves such issues by ensuring compatibility between your undertaking setup and trial configuration.

7. Align the Hierarchies of Your Test and Source Directories

Source: Stackoverflow

Ensure that the project ’ s brochure structure aligns with the expected frame-up. In a distinctive Gradle project, tryout classes should be under src/test/java. If examination classes are placed elsewhere, move them to the right location.

Talk to an Expert

Best Practices to Follow to Avoid the “ No Tests Found for Given Includes ” Error

Here are some of the best practice to prevent this error in the future:

1. Establishing Consistent Naming Conventions

Follow consistent naming conventions for the tryout classes and methods. This will help test frameworks recognize and run the tests more easy.

Here ’ s an example of how to configure Gradle to recognize JUnit tests using the nonremittal naming rule:

plugins {id 'java' id 'junit '} repositories {mavenCentral ()} colony {testImplementation 'org.junit.jupiter: junit-jupiter-api:5.7.1' testRuntimeOnly 'org.junit.jupiter: junit-jupiter-engine:5.7.1'} test {useJUnitPlatform () include ' * * / * Test.class' include ' * * / * Tests.class' testLogging {event `` PASSED '', `` FAILED '', `` SKIPPED '' showStandardStreams = true}}

2. Regularly Reviewing and Updating Configuration Files

Regularly review and update build.grade and other configuration file to ensure they are set up properly and remain compatible with the latest testing frameworks.

3. Implementing Automated Dependency Management

Use tools like Maven or Gradle to automate dependency management. This ensure that essay libraries are up-to-date and compatible with each former.

Why choose BrowserStack to execute JUnit Tests?

Executing or running JUnit tests on a reliable, scalable, and consistent platform is important for maintaining the quality and stability of the package.

offers a full-bodied cloud-based solution that makes JUnit testing easy and integrates seamlessly into the pipeline.

Here are some of the reasons why BrowserStack Automate is an ideal selection for running JUnit test:

  • Seamless CI/CD Integration: Easily mix with CI/CD tool like Jenkins, GitHub Actions, and GitLab for automated test performance.
  • Enhanced Debugging: Access elaborated log, screenshots, and video recordings for agile and efficient debugging.
  • Scalable and Reliable Infrastructure: Cloud-based testing with global data centers ensures fast and scalable execution with minimal latency.
  • Real Device Testing: Run JUnit tests on existent devices to detect issues that might miss.

Conclusion

The “NoTests Found for Given Includes ” error can be specify with proper configuration, correct imports, and version management.

By following some of the best practices and using reliable instrument like, enhance your testing experience and prevent these errors from recurring. It improves your testing process, providing better compatibility, and a politic experience.

Try BrowserStack Now

Tags
54,000+ Views

# Ask-and-Contributeabout this topic with our Discord community.

Related Guides

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free