FeatureParser extends KarateParserBaseListener { public static Feature parse(String relativePath) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); Path path = FileUtils.fromRelativeClassPath(relativePath, cl); return parse(new Resource(path, relativePath, -1)); } private  FeatureParser(File file, String relativePath, ClassLoader cl); private  FeatureParser(Resource resource); private  FeatureParser(Feature feature, InputStream is); static Feature parse(String relativePath); static Feature parse(File file); static Feature parse(Resource resource); static Feature parseText(Feature old, String text); static void updateStepFromText(Step step, String text); @Override void enterFeatureHeader(KarateParser.FeatureHeaderContext ctx); @Override void enterBackground(KarateParser.BackgroundContext ctx); @Override void enterScenario(KarateParser.ScenarioContext ctx); @Override void enterScenarioOutline(KarateParser.ScenarioOutlineContext ctx);  }
@Test public void testParsingFeatureDescription() { Feature feature = FeatureParser.parse("classpath:com/intuit/karate/core/test-simple.feature"); assertEquals("the first line", feature.getName()); assertEquals("and the second", feature.getDescription()); }
@Test public void testHide() { Feature feature = FeatureParser.parse("classpath:com/intuit/karate/core/test-hide.feature"); Step step = feature.getStep(0, -1, 0); assertTrue(step.isPrefixStar()); assertFalse(step.isPrint()); assertEquals("def a = 1", step.getText()); step = feature.getStep(0, -1, 1); assertTrue(step.isPrefixStar()); assertTrue(step.isPrint()); assertEquals("print a", step.getText()); step = feature.getStep(0, -1, 2); assertFalse(step.isPrefixStar()); assertTrue(step.isPrint()); assertEquals("print a", step.getText()); }