コード例 #1
0
  private ScenarioModel namedScenario(Description description) {
    Scenario scenarioAnnotation = description.getAnnotation(Scenario.class);
    Parameters parametersAnnotation = description.getAnnotation(Parameters.class);
    String name = null;

    if (scenarioHasDefinedName(scenarioAnnotation)) name = scenarioAnnotation.value();
    else name = createScenarioNameFromTestMethodName(description, parametersAnnotation);

    if (parametersAnnotation != null && !scenarioAnnotation.pending())
      name =
          name.substring(name.indexOf('(') + 1, name.indexOf(')'))
              + " ("
              + description
                  .getMethodName()
                  .substring(0, description.getMethodName().indexOf('(') - 1)
              + ")";

    return ScenarioManager.currentScenario().withName(name).withDescription(description);
  }
コード例 #2
0
 private boolean scenarioHasDefinedName(Scenario scenarioAnnotation) {
   return scenarioAnnotation != null
       && scenarioAnnotation.value() != null
       && !scenarioAnnotation.value().equals("");
 };