Exemplo n.º 1
0
 public String getNormalizedTestNameFor(final TestOutcome testOutcome, final String qualifier) {
   String userStory = "";
   if (testOutcome.getUserStory() != null) {
     userStory = NameConverter.underscore(testOutcome.getUserStory().getName()) + "_";
   }
   String normalizedQualifier = qualifier.replaceAll(" ", "_");
   return appendSuffixTo(
       userStory + withNoArguments(testOutcome.getMethodName()) + "_" + normalizedQualifier);
 }
Exemplo n.º 2
0
 /**
  * Return a filesystem-friendly version of the test case name. The filesytem version should have
  * no spaces and have the XML file suffix.
  */
 public String getNormalizedTestNameFor(final TestOutcome testOutcome) {
   String testName = "";
   if (testOutcome.getUserStory() != null) {
     testName = NameConverter.underscore(testOutcome.getUserStory().getName());
   }
   String scenarioName = NameConverter.underscore(testOutcome.getMethodName());
   testName = withNoIssueNumbers(withNoArguments(appendToIfNotNull(testName, scenarioName)));
   return appendSuffixTo(testName);
 }
 @Override
 public Optional<Requirement> getParentRequirementOf(TestOutcome testOutcome) {
   if (testOutcome.getUserStory() == null
       || testOutcome.getUserStory().getUserStoryClass() == null
       || testOutcome.getUserStory().getUserStoryClass().getName() == null) {
     return Optional.absent();
   }
   String name =
       testOutcome.getUserStory().getUserStoryClass().getName().replace(rootPackage + ".", "");
   return Optional.fromNullable(getRequirementsByPath().get(name));
 }
  @Test
  public void an_acceptance_test_relates_to_a_user_story() {
    net.thucydides.core.model.Story story =
        net.thucydides.core.model.Story.from(MyApp.MyUserStory.class);
    TestOutcome testOutcome = TestOutcome.forTestInStory("some_test", story);

    assertThat(testOutcome.getUserStory().getName(), is("My user story"));
  }
 @Test
 public void an_acceptance_test_records_the_original_story_class() {
   net.thucydides.core.model.Story story =
       net.thucydides.core.model.Story.from(MyApp.MyUserStory.class);
   TestOutcome testOutcome = TestOutcome.forTestInStory("some_test", story);
   assertThat(
       testOutcome.getUserStory().getUserStoryClass().getName(),
       is(MyApp.MyUserStory.class.getName()));
 }
  @Test
  public void a_test_outcome_can_be_initialized_directly_from_a_story() {
    testOutcome = TestOutcome.forTest("should_do_this", AUserStory.class);

    Assert.assertThat(testOutcome.getUserStory().getName(), is("A user story"));
  }