org.jbehave.core.parsers.RegexStoryParser Java Examples
The following examples show how to use
org.jbehave.core.parsers.RegexStoryParser.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Stories.java From attic-rave with Apache License 2.0 | 6 votes |
@Override public Configuration configuration() { Class<? extends Embeddable> embeddableClass = this.getClass(); // Start from default ParameterConverters instance ParameterConverters parameterConverters = new ParameterConverters(); // factory to allow parameter conversion and loading from external resources (used by StoryParser too) ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), new LoadFromClasspath(embeddableClass), parameterConverters); // add custom converters parameterConverters.addConverters( new DateConverter(new SimpleDateFormat("yyyy-MM-dd")), new ParameterConverters.EnumConverter() ); return new MostUsefulConfiguration() .useStoryLoader(new LoadFromClasspath(embeddableClass)) .useStoryParser(new RegexStoryParser(examplesTableFactory)) .useStoryReporterBuilder(new StoryReporterBuilder() .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass)) .withDefaultFormats() .withFormats(CONSOLE, TXT, HTML, XML)) .useParameterConverters(parameterConverters); }
Example #2
Source File: ExtendedConfiguration.java From vividus with Apache License 2.0 | 5 votes |
public void init() throws IOException { initKeywords(); initCompositePaths(); useParameterControls(parameterControls); useParameterConverters(new ParameterConvertersDecorator(this, parameterAdaptor, expressionAdaptor) .addConverters(customConverters)); useStoryParser(new RegexStoryParser(keywords(), examplesTableFactory())); TableTransformers transformers = tableTransformers(); customTableTransformers.forEach(transformers::useTransformer); useStepMonitor(new DelegatingStepMonitor(stepMonitors)); useStoryControls(storyControls); }
Example #3
Source File: ExtendedConfigurationTests.java From vividus with Apache License 2.0 | 5 votes |
@Test @PrepareForTest(ExtendedConfiguration.class) public void testInit() throws Exception { String compositePathPatterns = "**/*.steps"; List<String> compositePaths = List.of("/path/to/composite.steps"); when(pathFinder.findPaths(equalToCompositeStepsBatch(compositePathPatterns))).thenReturn(compositePaths); ExtendedConfiguration spy = spy(configuration); Keywords keywords = mock(Keywords.class); PowerMockito.whenNew(Keywords.class).withArguments(Keywords.defaultKeywords()).thenReturn(keywords); ExamplesTableFactory examplesTableFactory = mock(ExamplesTableFactory.class); when(spy.examplesTableFactory()).thenReturn(examplesTableFactory); RegexStoryParser regexStoryParser = mock(RegexStoryParser.class); PowerMockito.whenNew(RegexStoryParser.class).withArguments(keywords, examplesTableFactory) .thenReturn(regexStoryParser); ParameterConvertersDecorator parameterConverters = mock(ParameterConvertersDecorator.class); PowerMockito.whenNew(ParameterConvertersDecorator.class).withArguments(spy, parameterAdaptor, expressionAdaptor) .thenReturn(parameterConverters); List<ChainableParameterConverter<?, ?>> parameterConverterList = List.of(); when(parameterConverters.addConverters(parameterConverterList)).thenReturn(parameterConverters); StoryControls storyControls = mock(StoryControls.class); spy.setCustomConverters(parameterConverterList); spy.setCompositePaths(compositePathPatterns); spy.setStoryControls(storyControls); List<StepMonitor> stepMonitors = List.of(mock(StepMonitor.class)); spy.setStepMonitors(stepMonitors); spy.init(); verify(spy).useKeywords(keywords); verify(spy).useCompositePaths(new HashSet<>(compositePaths)); InOrder inOrder = inOrder(spy); inOrder.verify(spy).useParameterConverters(parameterConverters); inOrder.verify(spy).useStoryParser(regexStoryParser); verify(spy).useStoryControls(storyControls); verifyStepMonitor(spy, stepMonitors.get(0)); }
Example #4
Source File: UserRegistrationScenarios.java From user-registration-V2 with Apache License 2.0 | 5 votes |
@Override public Configuration configuration() { LocalizedKeywords keywords = new LocalizedKeywords(new Locale("de")); return new MostUsefulConfiguration() .useKeywords(keywords) .useStepCollector(new MarkUnmatchedStepsAsPending(keywords)) .useStoryParser(new RegexStoryParser(keywords)) .useStoryLoader(new LoadFromClasspath(this.getClass())) .useFailureStrategy(new RethrowingFailure()) .useStoryReporterBuilder( new StoryReporterBuilder().withKeywords(keywords) .withFormats(Format.HTML, Format.ANSI_CONSOLE) .withFailureTrace(true)); }