Skip to content

Commit

Permalink
Merge pull request #137 from qase-tms/135-error-in-running-cucumber-j…
Browse files Browse the repository at this point in the history
…unit-file

[cucumber 7] fix npe when parsing a feature-file
  • Loading branch information
savkk committed Jun 7, 2024
2 parents 187664c + 632c5d8 commit 8a7c356
Show file tree
Hide file tree
Showing 21 changed files with 37 additions and 28 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>io.qase</groupId>
<artifactId>qase-java</artifactId>
<packaging>pom</packaging>
<version>3.2.0</version>
<version>3.2.1</version>
<modules>
<module>qase-api</module>
<module>qase-testng</module>
Expand Down
2 changes: 1 addition & 1 deletion qase-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Add the following dependency and repository to your pom.xml:
<dependency>
<groupId>io.qase</groupId>
<artifactId>qase-api</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
</dependency>

```
Expand Down
2 changes: 1 addition & 1 deletion qase-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>qase-java</artifactId>
<groupId>io.qase</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion qase-cucumber3-jvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Add the following dependency and repository to your pom.xml:
<dependency>
<groupId>io.qase</groupId>
<artifactId>qase-cucumber3-jvm</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 1 addition & 1 deletion qase-cucumber3-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>qase-java</artifactId>
<groupId>io.qase</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion qase-cucumber4-jvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Add the following dependency and repository to your pom.xml:
<dependency>
<groupId>io.qase</groupId>
<artifactId>qase-cucumber4-jvm</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 1 addition & 1 deletion qase-cucumber4-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>qase-java</artifactId>
<groupId>io.qase</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion qase-cucumber5-jvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Add the following dependency and repository to your pom.xml:
<dependency>
<groupId>io.qase</groupId>
<artifactId>qase-cucumber5-jvm</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 1 addition & 1 deletion qase-cucumber5-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>qase-java</artifactId>
<groupId>io.qase</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion qase-cucumber6-jvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Add the following dependency and repository to your pom.xml:
<dependency>
<groupId>io.qase</groupId>
<artifactId>qase-cucumber6-jvm</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 1 addition & 1 deletion qase-cucumber6-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>qase-java</artifactId>
<groupId>io.qase</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion qase-cucumber7-jvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Add the following dependency and repository to your pom.xml:
<dependency>
<groupId>io.qase</groupId>
<artifactId>qase-cucumber7-jvm</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 1 addition & 1 deletion qase-cucumber7-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>qase-java</artifactId>
<groupId>io.qase</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
Expand Down Expand Up @@ -129,20 +130,28 @@ private void testRunFinished(TestRunFinished testRunFinished) {
}

private void testCaseStarted(TestCaseStarted event) {
parseGherkinFile(event);
getQaseTestCaseListener().onTestCaseStarted();
}

private void parseGherkinFile(TestCaseStarted event) {
if (EXAMPLES.get(getHash(event.getTestCase().getUri(), (long) event.getTestCase().getLocation().getLine())) == null) {
TestCase testCase = event.getTestCase();
URI uri = testCase.getUri();
GherkinParser gherkinParser = GherkinParser.builder().build();
try {
Path path = Paths.get(this.getClass().getClassLoader()
.getResource(uri.toString().replace("classpath:", "")).toURI());
URL resource = this.getClass().getClassLoader()
.getResource(uri.toString().replace("classpath:", ""));
if (resource == null) {
return;
}
Path path = Paths.get(resource.toURI());
Stream<Envelope> envelopes = gherkinParser.parse(path);
envelopes.forEach(e -> parseExamples(uri, e));
} catch (IOException | URISyntaxException e) {
log.error(e.getMessage());
}
}
getQaseTestCaseListener().onTestCaseStarted();
}

private void testCaseFinished(TestCaseFinished event) {
Expand Down
2 changes: 1 addition & 1 deletion qase-junit4-aspect/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.qase</groupId>
<artifactId>qase-java</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>

<artifactId>qase-junit4-aspect</artifactId>
Expand Down
8 changes: 4 additions & 4 deletions qase-junit4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Add the following dependency and repository to your pom.xml:
<dependency>
<groupId>io.qase</groupId>
<artifactId>qase-junit4</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -63,9 +63,9 @@ configurations {
dependencies {
aspectjweaver "org.aspectj:aspectjweaver:1.9.8"
testImplementation 'io.qase:qase-api:3.2.0'
testImplementation 'io.qase:qase-junit4:3.2.0'
testImplementation 'io.qase:qase-junit4-aspect:3.2.0'
testImplementation 'io.qase:qase-api:3.2.1'
testImplementation 'io.qase:qase-junit4:3.2.1'
testImplementation 'io.qase:qase-junit4-aspect:3.2.1'
testImplementation 'junit:junit:4.13.2'
}
Expand Down
2 changes: 1 addition & 1 deletion qase-junit4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>qase-java</artifactId>
<groupId>io.qase</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 2 additions & 2 deletions qase-junit5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Add the following dependency and repository to your pom.xml:
<dependency>
<groupId>io.qase</groupId>
<artifactId>qase-junit5</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
</dependency>
</dependencies>
<build>
Expand Down Expand Up @@ -55,7 +55,7 @@ add the below code to build.gradle:
```
dependencies {
...
testImplementation 'io.qase:qase-junit5:3.2.0'
testImplementation 'io.qase:qase-junit5:3.2.1'
}
test {
Expand Down
2 changes: 1 addition & 1 deletion qase-junit5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>qase-java</artifactId>
<groupId>io.qase</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 2 additions & 2 deletions qase-testng/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Add the following dependency to your pom.xml:
<dependency>
<groupId>io.qase</groupId>
<artifactId>qase-testng</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -67,7 +67,7 @@ configurations {
dependencies {
aspectjweaver "org.aspectj:aspectjweaver:1.9.8"
testImplementation 'io.qase:qase-testng:3.2.0'
testImplementation 'io.qase:qase-testng:3.2.1'
testImplementation 'org.testng:testng:7.1.0'
}
Expand Down
2 changes: 1 addition & 1 deletion qase-testng/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>qase-java</artifactId>
<groupId>io.qase</groupId>
<version>3.2.0</version>
<version>3.2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down

0 comments on commit 8a7c356

Please sign in to comment.