gherkin.formatter.Reporter Java Examples

The following examples show how to use gherkin.formatter.Reporter. 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: ParameterizedCucumber.java    From senbot with MIT License 5 votes vote down vote up
private ThreadAwareReporter(ThreadAwareFormatter threadAwareWrappedFormatter, 
		final ClassLoader classLoader,
		final RuntimeOptions runtimeOptions) {
	this.threadAwareWrappedFormatter = threadAwareWrappedFormatter;
	this.classLoader = classLoader;
	this.runtimeOptions = runtimeOptions;
	threadLocal = new ThreadLocal<Reporter>() {
      		@Override
      		protected Reporter initialValue() {
      			return runtimeOptions.reporter(classLoader);
      		}
      	};
}
 
Example #2
Source File: ParameterizedCucumber.java    From senbot with MIT License 5 votes vote down vote up
@Override
public void after(Match arg0, Result arg1) {
	Reporter wrappedReporter = getWrappedReporter();
	if(wrappedReporter != null) {
		wrappedReporter.after(arg0, arg1);
	}
}
 
Example #3
Source File: ParameterizedCucumber.java    From senbot with MIT License 5 votes vote down vote up
@Override
public void before(Match arg0, Result arg1) {
	Reporter wrappedReporter = getWrappedReporter();
	if(wrappedReporter != null) {
		wrappedReporter.before(arg0, arg1);
	}
	
}
 
Example #4
Source File: ParameterizedCucumber.java    From senbot with MIT License 5 votes vote down vote up
@Override
public void embedding(String arg0, byte[] arg1) {
	Reporter wrappedReporter = getWrappedReporter();
	if(wrappedReporter != null) {
		wrappedReporter.embedding(arg0, arg1);
	}
	
}
 
Example #5
Source File: ParameterizedCucumber.java    From senbot with MIT License 5 votes vote down vote up
@Override
public void match(Match arg0) {
	Reporter wrappedReporter = getWrappedReporter();
	if(wrappedReporter != null) {
		wrappedReporter.match(arg0);
	}
	
}
 
Example #6
Source File: ParameterizedCucumber.java    From senbot with MIT License 5 votes vote down vote up
@Override
public void result(Result arg0) {
	Reporter wrappedReporter = getWrappedReporter();
	if(wrappedReporter != null) {
		wrappedReporter.result(arg0);
	}
	
}
 
Example #7
Source File: ParameterizedCucumber.java    From senbot with MIT License 5 votes vote down vote up
@Override
public void write(String arg0) {
	Reporter wrappedReporter = getWrappedReporter();
	if(wrappedReporter != null) {
		wrappedReporter.write(arg0);
	}
	
}
 
Example #8
Source File: ParameterizedCucumber.java    From senbot with MIT License 4 votes vote down vote up
/**
	 * Constructor looping though the {@link Parameterized} {@link Runner}'s and
	 * adding the {@link CucumberFeature}'s found as children to each one
	 * ensuring the {@link TestEnvironment} is available for each {@link Runner}
	 * .
	 * 
	 * @param klass
	 * @throws Throwable
	 */
	public ParameterizedCucumber(Class<?> klass) throws Throwable {
    	
    	super(klass);
        
        log.debug("Initializing the ParameterizedCucumber runner");

        final ClassLoader classLoader = klass.getClassLoader();
        Assertions.assertNoCucumberAnnotatedMethods(klass);

//        Class<? extends Annotation>[] annotationClasses = new Class[]{CucumberOptions.class, Options.class};
//        RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(klass, annotationClasses);
        RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(klass);
        final RuntimeOptions runtimeOptions = runtimeOptionsFactory.create();

        ResourceLoader resourceLoader = new MultiLoader(classLoader);
//        ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
//        runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
        runtime = new Runtime(resourceLoader, classLoader, runtimeOptions);
        
        final ThreadAwareFormatter threadAwareWrappedFormatter = new ThreadAwareFormatter(runtimeOptions, classLoader);
        
        
        Reporter threadAwareReporter = new ThreadAwareReporter(threadAwareWrappedFormatter, classLoader, runtimeOptions);
        
		
		runtimeOptions.formatters.clear();
		runtimeOptions.formatters.add(threadAwareWrappedFormatter);
		
        jUnitReporter = new JUnitReporter(threadAwareReporter, threadAwareWrappedFormatter, runtimeOptions.strict);
        //overwrite the reporter so we can alter the path to write to
        
        List<CucumberFeature> cucumberFeatures = runtimeOptions.cucumberFeatures(resourceLoader);
        List<Runner> parameterizedChildren = super.getChildren();
        final SeleniumManager seleniumManager = SenBotContext.getSenBotContext().getSeleniumManager();
        final CucumberManager cucumberManager = SenBotContext.getSenBotContext().getCucumberManager();

        for (int i = 0; i < parameterizedChildren.size(); i++) {
        	BlockJUnit4ClassRunner paramRunner = (BlockJUnit4ClassRunner) parameterizedChildren.get(i);
        	final TestEnvironment environment = seleniumManager.getSeleniumTestEnvironments().get(i);
        
        	log.debug("Load runners for test envrironment: " + environment.toString());
        	
            for (final CucumberFeature cucumberFeature : cucumberFeatures) {
            	Feature originalFeature = cucumberFeature.getGherkinFeature();
            	
            	log.debug("Load runner for test cucumberFeature: " + originalFeature.getDescription() + " on evironment " + environment.toString());
                
            	ThreadPoolFeatureRunnerScheduler environmentFeatureRunner = new ThreadPoolFeatureRunnerScheduler(environment, 
            			cucumberFeature, 
            			runtime, 
            			jUnitReporter,
            			cucumberManager.getFeatureFileTimeout());
            	
            	setScheduler(environmentFeatureRunner);
				children.add(environmentFeatureRunner);
            }           
        }

    }
 
Example #9
Source File: ParameterizedCucumber.java    From senbot with MIT License 4 votes vote down vote up
private Reporter getWrapped() {
	return threadLocal.get();
}
 
Example #10
Source File: ParameterizedCucumber.java    From senbot with MIT License 4 votes vote down vote up
private Reporter getWrappedReporter() {
	if(Reporter.class.isAssignableFrom(getWrapped().getClass())) {
		return (Reporter) getWrapped();
	}
	return null;
}