/** * Set up a {@link StepExecution} as a test context attribute. * * @param testContext the current test context * @throws Exception if there is a problem * @see TestExecutionListener#prepareTestInstance(TestContext) */ @Override public void prepareTestInstance(TestContext testContext) throws Exception { StepExecution stepExecution = getStepExecution(testContext); if (stepExecution != null) { Method method = TestContext.class.getMethod(SET_ATTRIBUTE_METHOD_NAME, String.class, Object.class); ReflectionUtils.invokeMethod(method, testContext, STEP_EXECUTION, stepExecution); } }