-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cucumber-spring should use TestContextManager #448
Comments
I know its not perfect, but something like this on the SpringFactory should work. Actually it is close to what SpringJunit4ClassRunner does. public <T> T getInstance(final Class<T> type) {
try {
T instance = createTest(type);
TestContextManager contextManager = new TestContextManager(type);
contextManager.prepareTestInstance(instance);
return instance;
} catch (Exception exception) {
throw new CucumberException(exception.getMessage(), exception);
}
}
@SuppressWarnings("unchecked")
protected <T> T createTest(Class<T> type) throws Exception {
return (T) type.getConstructors()[0].newInstance();
} |
Would you be interested in sending a pull request for this with some tests? |
Sure, I'll send it this week! =) |
pasviegas
added a commit
to pasviegas/cucumber-jvm
that referenced
this issue
Mar 21, 2013
…unner and still trying to stick to the previous behaviour as much as possible
pasviegas
added a commit
to pasviegas/cucumber-jvm
that referenced
this issue
Mar 21, 2013
Merged
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Spring's JUnit and TestNG runners use
org.springframework.test.context.TestContextManager
internally. This class is available inorg.springframework:spring-test:3.2.0.RELEASE
.I think that using this internally somewhere in
cucumber.runtime.java.spring
would make it easier to fix #438 and possibly simplify/improve thecucumber-spring
module as well.I'm not familiar enough with Spring to implement this, so it would be great to get some help from previous cucumber-spring contributors. /cc @ffbit @vladimirkl @paoloambrosio @andrena @ovstetun
The text was updated successfully, but these errors were encountered: