-
-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null Pointer exception due to Step Class not able to be Injected/Resolved... #2150
Comments
Are you trying to run the Serenity test with JUnit 5? |
Yes I am and I got it running on Junit 4....I found that later on... Thanks for the response...I missed your comment.Apologies for the delay... |
This ticket can be closed if there is no further support for Junit 5... |
Yep, JUnit 5 runners aren't supported yet, so you need to run it using the legacy JUnit 4 mode. |
Thanks for the confirmation... |
I encountered this in Serenity 2.6.0 when using JUnit5 . I'm assuming it simply doesn't work yet since the JUnit 5 support is still in beta? |
Are you using the serenity-junit5 module? |
Yes :)
|
Thank you so so much for that example project! I was missing the line |
I am getting the following error.
java.lang.NullPointerException
at com.test.functional.employee.EmployeeServiceTest.testSuccessfullPost(EmployeeServiceTest.java:22)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
package com.test.functional.employee;
import com.testfunctional.employee.steps.EmployeeSteps;
import net.serenitybdd.junit.runners.SerenityRunner;
import net.thucydides.core.annotations.Narrative;
import net.thucydides.core.annotations.Steps;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
@RunWith(SerenityRunner.class)
@Narrative(text={"In order to test that the Employee Service is working properly",
"As a tester",
"I want to be able to execute the tests for various endpoints"})
public class EmployeeServiceTest {
}
My Step Files look like this
package uk.gov.hmcts.futurehearings.hmi.functional.employee.steps;
import net.thucydides.core.annotations.Step;
public class EmployeeSteps {
}
My dependencies are
//functionalTestCompile ("org.springframework.boot:spring-boot-starter-web")
//functionalTestCompile group: 'net.serenity-bdd', name: 'serenity-rest-assured', version: versions.serenity
functionalTestCompile group: 'net.serenity-bdd', name: 'serenity-core', version: versions.serenity
functionalTestCompile group: 'net.serenity-bdd', name: 'serenity-junit', version: versions.serenity
//functionalTestCompile group: 'net.serenity-bdd', name: 'serenity-spring', version: versions.serenity
functionalTestCompile group: 'net.serenity-bdd', name: 'serenity-screenplay', version :versions.serenity
//functionalTestCompile group: 'net.serenity-bdd', name: 'serenity-single-page-report', version: versions.serenityreporter
functionalTestCompile "ch.qos.logback:logback-classic:1.2.3"
functionalTestCompile "org.assertj:assertj-core:3.8.0"
functionalTestImplementation group: 'io.rest-assured', name: 'xml-path', version: versions.restAssured
functionalTestImplementation group: 'io.rest-assured', name: 'json-path', version: versions.restAssured
//functionalTestImplementation group: 'org.skyscreamer', name: 'jsonassert', version: '1.5.0'
with versions
def versions = [
junit : '5.6.2',
junitPlatform : '1.6.2',
reformLogging : '5.1.5',
springBoot : springBoot.class.package.implementationVersion,
springfoxSwagger: '2.9.2',
serenity : '2.2.9',
restAssured : '4.2.0',
serenityreporter : '2.1.4',
assertJ : '3.8.0',
logbackVersion : '1.2.3'
]
I am using Java 11 and Junit 5...
On running my test from the command line with the info option,I seem to get the following...
22:16:32.157 [Test worker] DEBUG org.apache.http.impl.conn.BasicClientConnectionManager - Releasing connection org.apache.http.impl.conn.ManagedClientConnectionImpl@3519571a
22:16:32.158 [Test worker] INFO net.serenitybdd.rest.decorators.request.RequestSpecificationDecorated - No BaseStepListener, GET not registered.
What could I be missing?Can someone help?????
The text was updated successfully, but these errors were encountered: