Beispiel #1
0
 // ******************** Alternative ********************
 Scenario alternative(String id, String title, Scenario scenario, String action) {
   if (id == null) {
     id = "A" + (alternativeFlows.size() + 1);
   }
   currentAlternativeFlow = new AlternativeFlow(id, title, selectedSteps, action);
   currentFlow = currentAlternativeFlow;
   currentFlow.setPrefix(currentFlow.getId().concat("."));
   alternativeFlows.add(currentAlternativeFlow);
   selectedSteps.clear();
   return this;
 }
Beispiel #2
0
 Scenario exception(String id, String title, Scenario scenario, Object... objects) {
   Condition condition = new Condition(objects);
   if (id == null) {
     id = "E" + (exceptionFlows.size() + 1);
   }
   currentExceptionFlow = new ExceptionFlow(id, title, selectedSteps, condition);
   currentFlow = currentExceptionFlow;
   currentFlow.setPrefix(currentFlow.getId().concat("."));
   exceptionFlows.add(currentExceptionFlow);
   selectedSteps.clear();
   return this;
 }
Beispiel #3
0
 @Override
 public void afterPlay(ReqContext context) {
   super.afterPlay(context);
   ScenarioSpec spec = getClass().getAnnotation(ScenarioSpec.class);
   if (spec == null) {
     throw new ReqPlayException(
         "Scenarios must be annotated with @ScenarioSpec: " + getClass().getCanonicalName());
   }
   feature = (Feature) context.getAsFeature(spec.feature());
   if (actorClass != null) {
     primaryActor = (Actor) context.getAsActor(actorClass);
   }
   for (Class<?> c : actorClasses) {
     actors.add((Actor) context.getAsActor(c));
   }
   mainFlow.afterPlay(context);
   if (!alternativeFlows.isEmpty()) {
     for (AlternativeFlow flow : alternativeFlows) {
       flow.afterPlay(context);
     }
   }
   if (!exceptionFlows.isEmpty()) {
     for (ExceptionFlow flow : exceptionFlows) {
       flow.afterPlay(context);
     }
   }
   if (!extensionPoints.isEmpty()) {
     for (ExtensionPoint ep : extensionPoints) {
       ep.afterPlay(context);
     }
   }
 }
Beispiel #4
0
 public Scenario orAt(String id) {
   if (selectedSteps.isEmpty()) {
     throw new ReqPlayException("Call at() before orAt()");
   }
   selectedSteps.add(mainFlow.get(id));
   return this;
 }
Beispiel #5
0
 public StepAPI step(String id, Object... objects) {
   currentStep = currentFlow.add(id, objects);
   if (steps.containsKey(id)) {
     throw new ReqPlayException("Step already exists:" + id);
   }
   steps.put(currentStep.getId(), currentStep);
   return new StepAPI(currentStep);
 }
Beispiel #6
0
 public Scenario at(String id) {
   selectedSteps.clear();
   selectedSteps.add(mainFlow.get(id));
   return this;
 }