String () { if (myRealStep instanceof HookTestStep) { try { Field definitionMatchField = myRealStep.getClass().getSuperclass().getDeclaredField("stepDefinitionMatch"); definitionMatchField.setAccessible(true); Object definitionMatchFieldValue = definitionMatchField.get(myRealStep); Field hookDefinitionField = definitionMatchFieldValue.getClass().getDeclaredField("hookDefinition"); hookDefinitionField.setAccessible(true); Object hookDefinitionFieldValue = hookDefinitionField.get(definitionMatchFieldValue); Field methodField = hookDefinitionFieldValue.getClass().getDeclaredField("method"); methodField.setAccessible(true); Object methodFieldValue = methodField.get(hookDefinitionFieldValue); if (methodFieldValue instanceof Method) { Method method = (Method)methodFieldValue; return String.format("java:test://%s/%s", method.getDeclaringClass().getName(), method.getName()); } } catch (Exception ignored) { } return ""; } PickleStepTestStep pickleStepTestStep = (PickleStepTestStep) myRealStep; return FILE_RESOURCE_PREFIX + pickleStepTestStep.getStepLocation() + ":" + pickleStepTestStep.getStepLine(); }