This repository was archived by the owner on Mar 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 120
Loggins for empty or non existing feature dir is added. Exeptions wil… #155
Open
vilkg
wants to merge
1
commit into
temyers:master
Choose a base branch
from
vilkg:issue_147
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.github.temyers.it</groupId> | ||
<artifactId>issue_147</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<description>An IT verifying the behavior when feature dir doesn't exist or is empty</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<cucumber.version>1.2.2</cucumber.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>info.cukes</groupId> | ||
<artifactId>cucumber-junit</artifactId> | ||
<version>${cucumber.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>info.cukes</groupId> | ||
<artifactId>cucumber-java</artifactId> | ||
<version>${cucumber.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<id>generateRunners</id> | ||
<phase>generate-test-sources</phase> | ||
<goals> | ||
<goal>generateRunners</goal> | ||
</goals> | ||
<configuration> | ||
<glue> | ||
<package>foo</package> | ||
<package>bar</package> | ||
</glue> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<featuresDirectory>src/test/resources/features/emptyDir</featuresDirectory> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
6 changes: 6 additions & 0 deletions
6
src/it/junit/issue_147-featuresDirEmpty/src/test/resources/features/feature1.feature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Scenario: Features directory is empty | ||
Given the features directory is empty | ||
When I perform a build | ||
Then a warning log message should be created | ||
But the build should succeed | ||
And no runners should be generated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
def logFile = new File(basedir, 'build.log') | ||
content = logFile.text | ||
|
||
assert content.contains('Features directory is empty. No runners will be generated') | ||
|
||
|
||
def directory = new File(basedir, "target/generated-test-sources/cucumber") | ||
|
||
assert directory.isDirectory() | ||
assert directory.listFiles().length==0 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,13 +190,20 @@ public class GenerateRunnersMojo extends AbstractMojo implements FileGeneratorCo | |
public void execute() throws MojoExecutionException { | ||
|
||
if (!featuresDirectory.exists()) { | ||
throw new MojoExecutionException("Features directory does not exist"); | ||
getLog().warn("Features directory does not exist"); | ||
return; | ||
} | ||
|
||
createOutputDirIfRequired(); | ||
|
||
final Collection<File> featureFiles = listFiles(featuresDirectory, new String[] {"feature"}, true); | ||
final List<File> sortedFeatureFiles = new NameFileComparator().sort(new ArrayList<File>(featureFiles)); | ||
|
||
createOutputDirIfRequired(); | ||
if (featureFiles.isEmpty()) { | ||
getLog().warn("Features directory is empty. No runners will be generated."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surefire informs us that there were no tests to run.
I think this should be It is also possible that when there are feature files, none generate runners due to a combination of tags. So I think this notification should be moved to the |
||
return; | ||
} | ||
|
||
final List<File> sortedFeatureFiles = new NameFileComparator().sort(new ArrayList<File>(featureFiles)); | ||
|
||
File packageDirectory = packageName == null | ||
? outputDirectory | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resources plugin just informs us about skipping the non existing resources but does include the missing directory name. The first keeps the messages standardized, the latter is helpful.
So I think this should be
skip non existing featuresDirectory /home/user/path/to/features