Cucumber在IDEA中出现‘No features found at "path"’报错求助
Hey there! Let's work through fixing that persistent "No features found" error you're seeing—this is a super common gotcha with behavior-driven test frameworks like Cucumber, so I’ve got a list of actionable checks to try:
1. Double-Check Feature File Paths & Naming
- First, confirm your
.featurefiles are stored in the directory your test runner is configured to scan. Most frameworks default tosrc/test/resources/featuresor a top-levelfeaturesfolder—if yours are elsewhere, you’ll need to explicitly point the runner there. - Verify filenames are correct: they must end with
.feature(not.featuresor a typo like.featrue), and avoid special characters or spaces that might break path resolution. - If you’re using the
--featuresparameter, make sure the path is either an absolute path, or a relative path from your project’s root directory. For example:
A tiny mistake like missing a# Correct relative path example cucumber --features ./src/test/resources/features/checkout.feature./or misspelling a folder name will cause the runner to miss your files entirely.
2. Validate Feature File Syntax
Even a tiny syntax error can make the runner refuse to recognize your feature file. Check for:
- Properly capitalized keywords (e.g.,
Feature:,Scenario:,Given—not lowercase) - Correct indentation (scenarios and steps should be indented under the
Featureblock) - No missing colons after keywords (easy typo to make!)
- If you’re using an IDE, install a BDD plugin (like Cucumber for IntelliJ) — it’ll highlight syntax errors in real time.
3. Review Test Runner Configuration
If you’re using a dedicated test runner class (common in Java/Kotlin projects), double-check the features path in your annotations:
@CucumberOptions( features = "src/test/resources/features", // Ensure this path matches your actual folder structure glue = "com.yourcompany.stepdefinitions" ) public class TestRunner {}
For command-line runs, make sure you’re not missing critical parameters like --glue (to point to your step definitions) — while this won’t cause "No features found" directly, a misconfigured glue path can sometimes mask underlying file discovery issues.
4. Confirm Build Tool & Project Structure Settings
- If you’re using Maven or Gradle, ensure your
.featurefiles are in a directory marked as a resource folder. For Maven,src/test/resourcesis default, but if you’ve placed files elsewhere, add a resource configuration to yourpom.xml:<build> <testResources> <testResource> <directory>src/test/custom-features</directory> </testResource> </testResources> </build> - Check that your
.gitignoreor build tool settings aren’t excluding.featurefiles—accidental exclusion means they won’t be copied to the classpath, so the runner can’t find them.
5. Clean Cache & Rebuild
Sometimes old build cache or IDE glitches cause files to be invisible to the runner:
- Run a clean build: For Maven,
mvn clean test-compile; for Gradle,./gradlew clean testClasses - Restart your IDE to clear any cached file indexes
Since you mentioned having screenshots of both with/without the --features parameter, take a close look at the working directory in those screenshots—if you’re running the command from a subfolder instead of the project root, your relative paths will be wrong.
内容的提问来源于stack exchange,提问作者Anton Zarovskiy

