I'm trying to run cucumber feature file tests for a Quarkus app, using quarkus-cucumber 0.6.0 (on Quarkus platform version 2.15.2.Final), but it fails to connect to the app.
Using the git project setup solution referenced here: quarkus-cucumber does not find step definitions I receive the following stack trace:
Step failed
java.net.ConnectException: Connection refused
at java.base/sun.nio.ch.Net.connect0(Native Method)
at java.base/sun.nio.ch.Net.connect(Net.java:579)
at java.base/sun.nio.ch.Net.connect(Net.java:568)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
at java.base/java.net.Socket.connect(Socket.java:633)
at ..
..
..
Failed scenarios:
file:///home/..../quarkus-cucumber-example/src/test/resources/specifications/everything_is_fine.feature:9 # You're still alright
2 Scenarios (1 failed, 1 passed)
8 Steps (1 failed, 7 passed)
0m1.821s
When running mvn test from the terminal, it runs successfully:
....~/..../quarkus-cucumber-example$ mvn test
..
..
..
2 Scenarios (2 passed)
8 Steps (8 passed)
0m0.800s
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.129 s - in com.example.test.AcceptanceTestRunner
When I debug and set breakpoints in this method:
public void everything_is_fine() {
when()
.get(BASE_URL + "health")
.then()
.statusCode(200);
}
and then Evaluate the when() expression, I discovered that the port is -1 rather than 8081. Hence the connection refused error. Has anyone else experienced this?
Adding the solution for the benefit of others...
One must edit the run configuration for your feature, and update the Main class to point to your the class that extends CucumberQuarkusTest.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.