private Map<String, Object> createBackground(TestCase testCase) { TestSourcesModel.AstNode astNode = testSources.getAstNode(currentFeatureFile, testCase.getLine()); if (astNode != null) { Background background = TestSourcesModel.getBackgroundForTestCase(astNode); Map<String, Object> testCaseMap = new HashMap<String, Object>(); testCaseMap.put("name", background.getName()); testCaseMap.put("line", background.getLocation().getLine()); testCaseMap.put("type", "background"); testCaseMap.put("keyword", background.getKeyword()); testCaseMap.put("description", background.getDescription() != null ? background.getDescription() : ""); testCaseMap.put("steps", new ArrayList<Map<String, Object>>()); return testCaseMap; } return null; }
private void printBackground(TestCase testCase) { TestSourcesModel.AstNode astNode = testSources.getAstNode(currentFeatureFile, testCase.getLine()); if (astNode != null) { Background background = TestSourcesModel.getBackgroundForTestCase(astNode); String backgroundText = getScenarioDefinitionText(background); boolean useBackgroundSteps = true; calculateLocationIndentation(SCENARIO_INDENT + backgroundText, testCase.getTestSteps(), useBackgroundSteps); String locationPadding = createPaddingToLocation(SCENARIO_INDENT, backgroundText); out.println(); out.println(SCENARIO_INDENT + backgroundText + locationPadding + getLocationText(currentFeatureFile, background.getLocation().getLine())); printDescription(background.getDescription()); } }