java.lang.Object
net.thucydides.model.domain.Story
Represents a given user story or feature.
Used to record test results and so on.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStory(String id, String storyName, String storyClassName, String displayName, String path, ApplicationFeature feature) Story(String id, String storyName, String storyClassName, String displayName, String path, PathElements pathElements, ApplicationFeature feature, String narrative) Story(String id, String storyName, String storyClassName, String displayName, String path, PathElements pathElements, ApplicationFeature feature, String narrative, String type) protected -
Method Summary
Modifier and TypeMethodDescriptionasTag()static Storybooleanstatic StoryObtain a story instance from a given story class.static StoryfromAnnotationsOn(Class<?> testClass) Builds a Story with a proper requirements hierarchy from string-based@Epic,@Feature, and@Storyannotations on the given class.static StoryfromAnnotationsOn(Class<?> testClass, String defaultStoryName) Builds a Story with a proper requirements hierarchy from string-based@Epic,@Feature, and@Storyannotations on the given class.static Class<?>getFeatureClass(Class<?> userStoryClass) What feature does this story belong to?getId()getName()Each story has a descriptive name.getPath()getRelativePath(List<String> rootElements) getReportName(ReportType type) Find the name of the report for this story for the specified report type (XML, HTML,...).getType()inthashCode()static Stringstatic StringstoryNameDefinedIn(Class<?> testClass) Returns the string-based story name defined on a class via@Story("name"), or null if not present.static StringstoryNameDefinedIn(Method method) Returns the string-based story name defined on a method via@Story("name"), or null if not present.static Class<?>testedInTestCase(Class<?> testClass) Returns the class representing the story that is tested by a given test class This is indicated by the Story annotation's storyClass attribute.withDisplayName(String name) static StoryCreate a story using a full class name as an id.static Storystatic StorywithIdAndPath(String storyId, String storyName, String storyPath) static StorywithIdAndPathAndFeature(String storyId, String storyName, String storyPath, String featureClassName, String featureName) withNarrative(String narrative) withStoryName(String name)
-
Constructor Details
-
Story
-
Story
-
Story
public Story(String id, String storyName, String storyClassName, String displayName, String path, PathElements pathElements, ApplicationFeature feature, String narrative) -
Story
public Story(String id, String storyName, String storyClassName, String displayName, String path, PathElements pathElements, ApplicationFeature feature, String narrative, String type) -
Story
protected Story(String id, String storyName, String displayName, ApplicationFeature feature, String path)
-
-
Method Details
-
pathOf
-
getId
-
from
Obtain a story instance from a given story class. Story instances are used for recording and reporting test results. -
withId
Create a story using a full class name as an id. Note that the class may no longer exist, so the story needs to be able to exist beyond the life of the original story class. This is used to deserialize stories from XML files. -
withNarrative
-
withType
-
withIdAndPath
-
withDisplayName
-
withStoryName
-
called
-
withId
-
withIdAndPathAndFeature
-
equals
-
hashCode
public int hashCode() -
getFeatureClass
What feature does this story belong to? -
testedInTestCase
Returns the class representing the story that is tested by a given test class This is indicated by the Story annotation's storyClass attribute. -
storyNameDefinedIn
Returns the string-based story name defined on a class via@Story("name"), or null if not present. -
storyNameDefinedIn
Returns the string-based story name defined on a method via@Story("name"), or null if not present. -
fromAnnotationsOn
Builds a Story with a proper requirements hierarchy from string-based@Epic,@Feature, and@Storyannotations on the given class. Walks the superclass chain so that annotations on parent classes are inherited. Returns null if no string-based annotations are present.The hierarchy is: Epic > Feature > Story. The path is built from whichever levels are present.
-
fromAnnotationsOn
Builds a Story with a proper requirements hierarchy from string-based@Epic,@Feature, and@Storyannotations on the given class. When@Storyis absent but@Featureor@Epicis present, uses thedefaultStoryName(typically from@DisplayName) as the story name, nesting it under the feature/epic in the hierarchy.- Parameters:
testClass- the test class to read annotations fromdefaultStoryName- fallback story name when no@Storyannotation is present (e.g. from@DisplayName)- Returns:
- a Story with the requirements hierarchy, or null if no annotations are present
-
getName
Each story has a descriptive name. This name is usually a human-readable version of the class name, or the story name for an easyb story. -
getDisplayName
-
getStoryClassName
-
getReportName
Find the name of the report for this story for the specified report type (XML, HTML,...). -
getReportName
-
getFeature
-
getPath
-
getRelativePath
-
getParentPathElements
-
getPathElements
-
getStoryName
-
getNarrative
-
getNarrativeSummary
-
getType
-
withPath
-
asFeature
-
asTag
-
asQualifiedTag
-
asSingleParentTag
-