All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.fmarmar.cucumber.tools.report.model.ScenarioWithBackground Maven / Gradle / Ivy

The newest version!
package com.github.fmarmar.cucumber.tools.report.model;

import java.util.Collections;
import java.util.List;

import com.github.fmarmar.cucumber.tools.report.model.support.ScenarioResult;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper=true)
public class ScenarioWithBackground extends Scenario {

	private String backgroundName;
	
	private List backgroundSteps = Collections.emptyList();
	
	public ScenarioWithBackground(Scenario scenario, Scenario background) {
		
		this.id = scenario.id;
		this.name = scenario.name;
		this.description = scenario.description;
		this.type = scenario.type;
		this.tags = Sets.newTreeSet(Iterables.concat(background.tags, scenario.tags));
		this.before = Lists.newArrayList(Iterables.concat(background.before, scenario.before));
		this.backgroundName = background.name;
		this.backgroundSteps = background.steps;
		this.steps = scenario.steps;
		this.after = scenario.after;
		
	}
	
	@Override
	public void postProcess() {
		stepsSummary = summary(Iterables.concat(backgroundSteps, steps));
		result = ScenarioResult.result(getExecutionElements());
	}
	
	@Override
	public Iterable getExecutionElements() {
		return Iterables.concat(before, executionElements(backgroundSteps), executionElements(steps), after);
	}
	
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy