Exemple #1
0
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            text = u"""\
# language: fi

Tapausaihio: Montako yötä on jouluun
Oletetaan, että tänään on <päivä>. joulukuuta.
Kun avaan vielä <avaukset> luukkua joulukalenterista,
niin jouluun on enää <jäljellä> yötä.

Tapaukset:
| päivä | avaukset | jäljellä |
| 1     | 2        | 21       |
| 21    | 3        | 0        |
"""
            appendScenarios(story1, text)
Exemple #2
0
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2", "Second story", points=3, status="closed",
                resolution="fixed", priority="high", epic=epic1)
            epic1.stories.append(story2)

            text = """\
Scenario: First scenario
Given something
When something happens
Then do something
  And something else

Scenario: Second scenario
Given something
When something happens
Then do something
  And something else
"""
            appendScenarios(story1, text)
def fileSource(path):
    """Read a file containing a CoreJet XML document
    """

    catalogue = RequirementsCatalogue()
    with open(path) as stream:
        catalogue.populate(stream)
    return catalogue
def fileSource(path):
    """Read a file containing a CoreJet XML document
    """
    
    catalogue = RequirementsCatalogue()
    with open(path) as stream:
        catalogue.populate(stream)
    return catalogue
Exemple #5
0
        def create(self):
            from corejet.core.model import RequirementsCatalogue
            from corejet.core.model import Epic, Story, Scenario, Step

            self.catalogue = RequirementsCatalogue(
                project="Test project",
                extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0),
                testTime=datetime.datetime(2011, 1, 2, 12, 5, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1",
                           "First story",
                           points=3,
                           status="open",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2",
                           "Second story",
                           points=3,
                           status="closed",
                           resolution="fixed",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story2)

            scenario1 = Scenario(
                "First scenario",
                story=story1,
                givens=[Step("something", 'given')],
                whens=[Step("something happens", 'when')],
                thens=[
                    Step("do something", 'then'),
                    Step("and something else", 'then')
                ],
                status="pass",
            )
            story1.scenarios.append(scenario1)

            scenario2 = Scenario(
                "Second scenario",
                story=story2,
                givens=[Step("something", 'given')],
                whens=[Step("something happens", 'when')],
                thens=[
                    Step("do something", 'then'),
                    Step("and something else", 'then')
                ],
                status="mismatch",
            )
            story1.scenarios.append(scenario2)
Exemple #6
0
    class Scenario(Scenario):

        @given(u"A requirements catalogue file extracted with requirements")
        def given(self):
            with open(os.path.join(self.tmpdir, 'input.xml'), 'w') as f:
                f.write("""\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <given>some background</given>
      <given>more background</given>
      <scenario name="First scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
      <scenario name="Second scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
    </story>
    <story id="S2" title="Second story" points="3" requirementStatus="closed" requirementResolution="fixed" priority="high"/>
  </epic>
  <epic id="E2" title="Second epic"/>
</requirementscatalogue>
""")

        @when(u"The populate() method is called")
        def when(self):
            from corejet.core.model import RequirementsCatalogue
            self.catalogue = RequirementsCatalogue()
            with open(os.path.join(self.tmpdir, 'input.xml'), 'r') as f:
                self.catalogue.populate(f)

        @then(u"A minimal requirements catalogue is built")
        def then(self):
            self.assertEqual(len(self.catalogue.epics), 2)
            self.assertEqual(len(self.catalogue.epics[0].stories), 2)
            self.assertEqual(len(self.catalogue.epics[1].stories), 0)

            self.assertEqual(len(self.catalogue.epics[0].stories[0].givens), 2)
            self.assertEqual(self.catalogue.epics[0].stories[0].givens[0].text, "some background")
            self.assertEqual(self.catalogue.epics[0].stories[0].givens[1].text, "more background")

            self.assertEqual(len(self.catalogue.epics[0].stories[1].givens), 0)
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2", "Second story", points=3, status="closed",
                resolution="fixed", priority="high", epic=epic1)
            epic1.stories.append(story2)

            text = """\
Scenario Outline: Count some apples
Given I have <Start amount> apples
When I get <Red> red and <Green> green apples more
Then I have a total of <Sum> apples

Examples:
| Start amount | Red | Green | Sum |
| 2            | 3   | 4     | 9   |
| 3            | 4   | 5     | 12  |
"""
            appendScenarios(story1, text)
        def create(self):
            from corejet.core.model import RequirementsCatalogue
            from corejet.core.model import Epic, Story, Scenario, Step

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011,1,2,12,1,0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2", "Second story", points=3, status="closed",
                resolution="fixed", priority="high", epic=epic1)
            epic1.stories.append(story2)

            scenario1 = Scenario("First scenario", story=story1,
                    givens=[Step("something", 'given')],
                    whens=[Step("something happens", 'when')],
                    thens=[Step("do something", 'then'), Step("and something else", 'then')],
                )
            story1.scenarios.append(scenario1)

            scenario2 = Scenario("Second scenario", story=story2,
                    givens=[Step("something", 'given')],
                    whens=[Step("something happens", 'when')],
                    thens=[Step("do something", 'then'), Step("and something else", 'then')],
                )
            story1.scenarios.append(scenario2)
Exemple #9
0
    class Scenario(Scenario):

        @given(u"A requirements catalogue containing user requirements")
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            text = u"""\
# language: fi

Tapausaihio: Montako yötä on jouluun
Oletetaan, että tänään on <päivä>. joulukuuta.
Kun avaan vielä <avaukset> luukkua joulukalenterista,
niin jouluun on enää <jäljellä> yötä.

Tapaukset:
| päivä | avaukset | jäljellä |
| 1     | 2        | 21       |
| 21    | 3        | 0        |
"""
            appendScenarios(story1, text)

        @when(u"The serialize() method is called")
        def when(self):
            self.tree = self.catalogue.serialize()

        @then(u"An XML tree is output containing epic, story and scenario")
        def then(self):
            self.assertEqual(
                unicode(lxml.etree.tostring(self.tree, pretty_print=True,
                                            encoding="utf-8"),
                        "utf-8").strip(), u"""\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="Montako yötä on jouluun #01">
        <given>tänään on 1. joulukuuta</given>
        <when>avaan vielä 2 luukkua joulukalenterista</when>
        <then>jouluun on enää 21 yötä</then>
      </scenario>
      <scenario name="Montako yötä on jouluun #02">
        <given>tänään on 21. joulukuuta</given>
        <when>avaan vielä 3 luukkua joulukalenterista</when>
        <then>jouluun on enää 0 yötä</then>
      </scenario>
    </story>
  </epic>
</requirementscatalogue>""".strip())
Exemple #10
0
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(
                project="Test project",
                extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1",
                           "First story",
                           points=3,
                           status="open",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2",
                           "Second story",
                           points=3,
                           status="closed",
                           resolution="fixed",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story2)

            text = """\
Scenario Outline: Count some apples
Given I have <Start amount> apples
When I get <Red> red and <Green> green apples more
Then I have a total of <Sum> apples

Examples:
| Start amount | Red | Green | Sum |
| 2            | 3   | 4     | 9   |
| 3            | 4   | 5     | 12  |
"""
            appendScenarios(story1, text)
Exemple #11
0
    class MinimalInput(Scenario):
        @given("A minimal requirements catalogue file")
        def create(self):
            with open(os.path.join(self.tmpdir, 'input.xml'), 'w') as f:
                f.write("""\
<requirementscatalogue />
""")

        @when("The populate() method is called")
        def serialize(self):
            from corejet.core.model import RequirementsCatalogue
            self.catalogue = RequirementsCatalogue()
            with open(os.path.join(self.tmpdir, 'input.xml'), 'r') as f:
                self.catalogue.populate(f)

        @then("A minimal requirements catalogue is built")
        def checkInput(self):
            self.assertEqual(self.catalogue.extractTime, None)
            self.assertEqual(self.catalogue.testTime, None)
            self.assertEqual(self.catalogue.project, None)
            self.assertEqual(self.catalogue.epics, [])
Exemple #12
0
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            text = u"""\
# language: fi

Tapaus: RTFM suomeksi
Oletetaan, että olen pulassa.
Kun klikkaan "Ohjeet"-linkkiä,
niin löydän apua.
"""
            appendScenarios(story1, text)
Exemple #13
0
    class MinimalInput(Scenario):

        @given("A minimal requirements catalogue file")
        def create(self):
            with open(os.path.join(self.tmpdir, 'input.xml'), 'w') as f:
                f.write("""\
<requirementscatalogue />
""")

        @when("The populate() method is called")
        def serialize(self):
            from corejet.core.model import RequirementsCatalogue
            self.catalogue = RequirementsCatalogue()
            with open(os.path.join(self.tmpdir, 'input.xml'), 'r') as f:
                self.catalogue.populate(f)

        @then("A minimal requirements catalogue is built")
        def checkInput(self):
            self.assertEqual(self.catalogue.extractTime, None)
            self.assertEqual(self.catalogue.testTime, None)
            self.assertEqual(self.catalogue.project, None)
            self.assertEqual(self.catalogue.epics, [])
Exemple #14
0
    class Scenario(Scenario):

        @given(u"A requirements catalogue containing user requirements")
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            text = u"""\
# language: fi

Tapaus: Ensimmäinen tapaus
Oletetaan, että ajan polkupyörällä,
  mutta minulla ei ole pyöräilykypärää.
Kun törmään liikenteessä autoon,
niin minulle käy tosi huonosti,
  mutta auton kuljettaja voi selvitä vammoitta.
"""
            appendScenarios(story1, text)

        @when(u"The serialize() method is called")
        def when(self):
            self.tree = self.catalogue.serialize()

        @then(u"An XML tree is output containing epic, story and scenario")
        def then(self):
            self.assertEqual(
                unicode(lxml.etree.tostring(self.tree, pretty_print=True,
                                            encoding="utf-8"),
                        "utf-8").strip(), u"""\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="Ensimmäinen tapaus">
        <given>ajan polkupyörällä</given>
        <given>minulla ei ole pyöräilykypärää</given>
        <when>törmään liikenteessä autoon</when>
        <then>minulle käy tosi huonosti</then>
        <then>auton kuljettaja voi selvitä vammoitta</then>
      </scenario>
    </story>
  </epic>
</requirementscatalogue>""".strip())
Exemple #15
0
    class MinimalOutput(Scenario):
        @given("An empty requirements catalogue")
        def create(self):
            from corejet.core.model import RequirementsCatalogue
            self.catalogue = RequirementsCatalogue()

        @when("The serialize() method is called")
        def serialize(self):
            self.tree = self.catalogue.serialize()

        @then("A minimal XML tree is output")
        def checkOutput(self):
            output = lxml.etree.tostring(self.tree)
            self.assertEqual(output, '<requirementscatalogue/>')
Exemple #16
0
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            text = u"""\
# language: fi

Tapaus: Toinen tapaus
Oletetaan, että olen 1. ja 2. korttelin välissä.
Kun katson suoraan oikealle
niin näen uuden kirjakaupan
  ja kauniin näyteikkunan.
"""
            appendScenarios(story1, text)
Exemple #17
0
    class Scenario(Scenario):

        @given(u"A requirements catalogue containing user requirements")
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            text = u"""\
# language: fi

Tapaus: Toinen tapaus
Oletetaan, että olen 1. ja 2. korttelin välissä.
Kun katson suoraan oikealle
niin näen uuden kirjakaupan
  ja kauniin näyteikkunan.
"""
            appendScenarios(story1, text)

        @when(u"The serialize() method is called")
        def when(self):
            self.tree = self.catalogue.serialize()

        @then(u"An XML tree is output containing epic, story and scenario")
        def then(self):
            self.assertEqual(
                unicode(lxml.etree.tostring(self.tree, pretty_print=True,
                                            encoding="utf-8"),
                        "utf-8").strip(), u"""\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="Toinen tapaus">
        <given>olen 1. ja 2. korttelin välissä</given>
        <when>katson suoraan oikealle</when>
        <then>näen uuden kirjakaupan</then>
        <then>kauniin näyteikkunan</then>
      </scenario>
    </story>
  </epic>
</requirementscatalogue>""".strip())
Exemple #18
0
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            text = u"""\
# language: fi

Tapaus: Ensimmäinen tapaus
Oletetaan, että ajan polkupyörällä,
  mutta minulla ei ole pyöräilykypärää.
Kun törmään liikenteessä autoon,
niin minulle käy tosi huonosti,
  mutta auton kuljettaja voi selvitä vammoitta.
"""
            appendScenarios(story1, text)
    class MinimalOutput(Scenario):

        @given("An empty requirements catalogue")
        def create(self):
            from corejet.core.model import RequirementsCatalogue
            self.catalogue = RequirementsCatalogue()

        @when("The serialize() method is called")
        def serialize(self):
            self.tree = self.catalogue.serialize()

        @then("A minimal XML tree is output")
        def checkOutput(self):
            output = lxml.etree.tostring(self.tree)
            self.assertEqual(output, '<requirementscatalogue/>')
Exemple #20
0
    class Scenario(Scenario):

        @given(u"A requirements catalogue containing user requirements")
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            text = u"""\
# language: fi

Tapaus: RTFM suomeksi
Oletetaan, että olen pulassa.
Kun klikkaan "Ohjeet"-linkkiä,
niin löydän apua.
"""
            appendScenarios(story1, text)

        @when(u"The serialize() method is called")
        def when(self):
            self.tree = self.catalogue.serialize()

        @then(u"An XML tree is output containing epic, story and scenario")
        def then(self):
            self.assertEqual(
                unicode(lxml.etree.tostring(self.tree, pretty_print=True,
                                            encoding="utf-8"),
                        "utf-8").strip(), u"""\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="RTFM suomeksi">
        <given>olen pulassa</given>
        <when>klikkaan 'Ohjeet'-linkkiä</when>
        <then>löydän apua</then>
      </scenario>
    </story>
  </epic>
</requirementscatalogue>""".strip())
Exemple #21
0
    class RequirementsExtract(Scenario):

        @given("A requirements catalogue file extracted with requirements")
        def create(self):
            with open(os.path.join(self.tmpdir, 'input.xml'), 'w') as f:
                f.write("""\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="First scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
      <scenario name="Second scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
    </story>
    <story id="S2" title="Second story" points="3" requirementStatus="closed" requirementResolution="fixed" priority="high"/>
  </epic>
  <epic id="E2" title="Second epic"/>
</requirementscatalogue>
""")

        @when("The populate() method is called")
        def serialize(self):
            from corejet.core.model import RequirementsCatalogue
            self.catalogue = RequirementsCatalogue()
            with open(os.path.join(self.tmpdir, 'input.xml'), 'r') as f:
                self.catalogue.populate(f)

        @then("A minimal requirements catalogue is built")
        def checkInput(self):
            self.assertEqual(self.catalogue.extractTime, datetime.datetime(2011, 1, 2, 12, 1, 0))
            self.assertEqual(self.catalogue.testTime, None)
            self.assertEqual(self.catalogue.project, "Test project")
            self.assertEqual(len(self.catalogue.epics), 2)

            self.assertEqual(self.catalogue.epics[0].name, "E1")
            self.assertEqual(self.catalogue.epics[0].title, "First epic")
            self.assertEqual(len(self.catalogue.epics[0].stories), 2)

            self.assertEqual(self.catalogue.epics[1].name, "E2")
            self.assertEqual(self.catalogue.epics[1].title, "Second epic")
            self.assertEqual(len(self.catalogue.epics[1].stories), 0)

            self.assertEqual(self.catalogue.epics[0].stories[0].name, "S1")
            self.assertEqual(self.catalogue.epics[0].stories[0].title, "First story")
            self.assertEqual(self.catalogue.epics[0].stories[0].points, 3)
            self.assertEqual(self.catalogue.epics[0].stories[0].status, "open")
            self.assertEqual(self.catalogue.epics[0].stories[0].resolution, None)
            self.assertEqual(self.catalogue.epics[0].stories[0].priority, "high")
            self.assertEqual(len(self.catalogue.epics[0].stories[0].scenarios), 2)

            self.assertEqual(self.catalogue.epics[0].stories[1].name, "S2")
            self.assertEqual(self.catalogue.epics[0].stories[1].title, "Second story")
            self.assertEqual(self.catalogue.epics[0].stories[1].points, 3)
            self.assertEqual(self.catalogue.epics[0].stories[1].status, "closed")
            self.assertEqual(self.catalogue.epics[0].stories[1].resolution, "fixed")
            self.assertEqual(self.catalogue.epics[0].stories[1].priority, "high")
            self.assertEqual(len(self.catalogue.epics[0].stories[1].scenarios), 0)

            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[0].name, "First scenario")
            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[0].status, None)
            self.assertEqual(len(self.catalogue.epics[0].stories[0].scenarios[0].givens), 1)
            self.assertEqual(len(self.catalogue.epics[0].stories[0].scenarios[0].whens), 1)
            self.assertEqual(len(self.catalogue.epics[0].stories[0].scenarios[0].thens), 2)

            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[1].name, "Second scenario")
            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[1].status, None)
            self.assertEqual(len(self.catalogue.epics[0].stories[0].scenarios[1].givens), 1)
            self.assertEqual(len(self.catalogue.epics[0].stories[0].scenarios[1].whens), 1)
            self.assertEqual(len(self.catalogue.epics[0].stories[0].scenarios[1].thens), 2)

            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[0].givens[0].text, "something")
            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[0].whens[0].text, "something happens")
            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[0].thens[0].text, "do something")
            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[0].thens[1].text, "and something else")

            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[1].givens[0].text, "something")
            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[1].whens[0].text, "something happens")
            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[1].thens[0].text, "do something")
            self.assertEqual(self.catalogue.epics[0].stories[0].scenarios[1].thens[1].text, "and something else")
Exemple #22
0
    class RequirementsExtract(Scenario):
        @given("A requirements catalogue containing user requirements")
        def create(self):
            from corejet.core.model import RequirementsCatalogue
            from corejet.core.model import Epic, Story, Scenario, Step

            self.catalogue = RequirementsCatalogue(
                project="Test project",
                extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1",
                           "First story",
                           points=3,
                           status="open",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2",
                           "Second story",
                           points=3,
                           status="closed",
                           resolution="fixed",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story2)

            scenario1 = Scenario(
                "First scenario",
                story=story1,
                givens=[Step("something", 'given')],
                whens=[Step("something happens", 'when')],
                thens=[
                    Step("do something", 'then'),
                    Step("and something else", 'then')
                ],
            )
            story1.scenarios.append(scenario1)

            scenario2 = Scenario(
                "Second scenario",
                story=story2,
                givens=[Step("something", 'given')],
                whens=[Step("something happens", 'when')],
                thens=[
                    Step("do something", 'then'),
                    Step("and something else", 'then')
                ],
            )
            story1.scenarios.append(scenario2)

        @when("The serialize() method is called")
        def serialize(self):
            self.tree = self.catalogue.serialize()

        @then(
            "An XML tree is output containing all epics, stories and scenarios"
        )
        def checkOutput(self):
            self.assertEqual(
                lxml.etree.tostring(self.tree, pretty_print=True).strip(), """\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="First scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
      <scenario name="Second scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
    </story>
    <story id="S2" title="Second story" points="3" requirementStatus="closed" requirementResolution="fixed" priority="high"/>
  </epic>
  <epic id="E2" title="Second epic"/>
</requirementscatalogue>""".strip())
Exemple #23
0
    class Scenario(Scenario):
        @given(u"A requirements catalogue containing user requirements")
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(
                project="Test project",
                extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1",
                           "First story",
                           points=3,
                           status="open",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2",
                           "Second story",
                           points=3,
                           status="closed",
                           resolution="fixed",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story2)

            text = """\
Scenario Outline: Count some apples
Given I have <Start amount> apples
When I get <Red> red and <Green> green apples more
Then I have a total of <Sum> apples

Examples:
| Start amount | Red | Green | Sum |
| 2            | 3   | 4     | 9   |
| 3            | 4   | 5     | 12  |
"""
            appendScenarios(story1, text)

        @when(u"The serialize() method is called")
        def when(self):
            self.tree = self.catalogue.serialize()

        @then(u"An XML tree is output containing all epics, stories "
              u"and scenarios")
        def then(self):
            self.assertEqual(
                lxml.etree.tostring(self.tree, pretty_print=True).strip(), """\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="Count some apples #01">
        <given>I have 2 apples</given>
        <when>I get 3 red and 4 green apples more</when>
        <then>I have a total of 9 apples</then>
      </scenario>
      <scenario name="Count some apples #02">
        <given>I have 3 apples</given>
        <when>I get 4 red and 5 green apples more</when>
        <then>I have a total of 12 apples</then>
      </scenario>
    </story>
    <story id="S2" title="Second story" points="3" requirementStatus="closed" requirementResolution="fixed" priority="high"/>
  </epic>
  <epic id="E2" title="Second epic"/>
</requirementscatalogue>""".strip())
Exemple #24
0
    class Writing(Scenario):
        @given("A temporary directory")
        def tempDir(self):
            self.tmpdir = tempfile.mkdtemp()

        @given("A requirements catalogue containing user requirements")
        def create(self):
            from corejet.core.model import RequirementsCatalogue
            from corejet.core.model import Epic, Story, Scenario, Step

            self.catalogue = RequirementsCatalogue(
                project="Test project",
                extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0),
                testTime=datetime.datetime(2011, 1, 2, 12, 5, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1",
                           "First story",
                           points=3,
                           status="open",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2",
                           "Second story",
                           points=3,
                           status="closed",
                           resolution="fixed",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story2)

            scenario1 = Scenario(
                "First scenario",
                story=story1,
                givens=[Step("something", 'given')],
                whens=[Step("something happens", 'when')],
                thens=[
                    Step("do something", 'then'),
                    Step("and something else", 'then')
                ],
                status="pass",
            )
            story1.scenarios.append(scenario1)

            scenario2 = Scenario(
                "Second scenario",
                story=story2,
                givens=[Step("something", 'given')],
                whens=[Step("something happens", 'when')],
                thens=[
                    Step("do something", 'then'),
                    Step("and something else", 'then')
                ],
                status="mismatch",
            )
            story1.scenarios.append(scenario2)

        @when(
            "The write() method is called with a file in the temporary directory"
        )
        def serialize(self):
            with open(os.path.join(self.tmpdir, 'output.xml'), 'w') as f:
                self.catalogue.write(f)

        @then(
            "An XML tree is output containing all epics, stories and scenarios"
        )
        def checkOutput(self):
            self.assertEqual(
                open(os.path.join(self.tmpdir, 'output.xml'),
                     'r').read().strip(), """\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00" testTime="2011-01-02T12:05:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="First scenario" testStatus="pass">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
      <scenario name="Second scenario" testStatus="mismatch">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
    </story>
    <story id="S2" title="Second story" points="3" requirementStatus="closed" requirementResolution="fixed" priority="high"/>
  </epic>
  <epic id="E2" title="Second epic"/>
</requirementscatalogue>""".strip())

        @then("Clean up")
        def cleanUp(self):
            shutil.rmtree(self.tmpdir)
 def create(self):
     from corejet.core.model import RequirementsCatalogue
     self.catalogue = RequirementsCatalogue()
    class Writing(Scenario):

        @given("A temporary directory")
        def tempDir(self):
            self.tmpdir = tempfile.mkdtemp()

        @given("A requirements catalogue containing user requirements")
        def create(self):
            from corejet.core.model import RequirementsCatalogue
            from corejet.core.model import Epic, Story, Scenario, Step

            self.catalogue = RequirementsCatalogue(project="Test project",
                extractTime=datetime.datetime(2011,1,2,12,1,0),
                testTime=datetime.datetime(2011,1,2,12,5,0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2", "Second story", points=3, status="closed",
                resolution="fixed", priority="high", epic=epic1)
            epic1.stories.append(story2)

            scenario1 = Scenario("First scenario", story=story1,
                    givens=[Step("something", 'given')],
                    whens=[Step("something happens", 'when')],
                    thens=[Step("do something", 'then'), Step("and something else", 'then')],
                    status="pass",
                )
            story1.scenarios.append(scenario1)

            scenario2 = Scenario("Second scenario", story=story2,
                    givens=[Step("something", 'given')],
                    whens=[Step("something happens", 'when')],
                    thens=[Step("do something", 'then'), Step("and something else", 'then')],
                    status="mismatch",
                )
            story1.scenarios.append(scenario2)

        @when("The write() method is called with a file in the temporary directory")
        def serialize(self):
            with open(os.path.join(self.tmpdir, 'output.xml'), 'w') as f:
                self.catalogue.write(f)

        @then("An XML tree is output containing all epics, stories and scenarios")
        def checkOutput(self):
            self.assertEqual(open(os.path.join(self.tmpdir, 'output.xml'), 'r').read().strip(), """\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00" testTime="2011-01-02T12:05:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="First scenario" testStatus="pass">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
      <scenario name="Second scenario" testStatus="mismatch">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
    </story>
    <story id="S2" title="Second story" points="3" requirementStatus="closed" requirementResolution="fixed" priority="high"/>
  </epic>
  <epic id="E2" title="Second epic"/>
</requirementscatalogue>""".strip())

        @then("Clean up")
        def cleanUp(self):
            shutil.rmtree(self.tmpdir)
Exemple #27
0
 def create(self):
     from corejet.core.model import RequirementsCatalogue
     self.catalogue = RequirementsCatalogue()
    class TestRunExtract(Scenario):

        @given("A requirements catalogue containing test results")
        def create(self):
            from corejet.core.model import RequirementsCatalogue
            from corejet.core.model import Epic, Story, Scenario, Step

            self.catalogue = RequirementsCatalogue(project="Test project",
                extractTime=datetime.datetime(2011,1,2,12,1,0),
                testTime=datetime.datetime(2011,1,2,12,5,0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2", "Second story", points=3, status="closed",
                resolution="fixed", priority="high", epic=epic1)
            epic1.stories.append(story2)

            scenario1 = Scenario("First scenario", story=story1,
                    givens=[Step("something", 'given')],
                    whens=[Step("something happens", 'when')],
                    thens=[Step("do something", 'then'), Step("and something else", 'then')],
                    status="pass",
                )
            story1.scenarios.append(scenario1)

            scenario2 = Scenario("Second scenario", story=story2,
                    givens=[Step("something", 'given')],
                    whens=[Step("something happens", 'when')],
                    thens=[Step("do something", 'then'), Step("and something else", 'then')],
                    status="mismatch",
                )
            story1.scenarios.append(scenario2)

        @when("The serialize() method is called")
        def serialize(self):
            self.tree = self.catalogue.serialize()

        @then("An XML tree is output containing all epics, stories and scenarios and their status")
        def checkOutput(self):
            self.assertEqual(lxml.etree.tostring(self.tree, pretty_print=True).strip(), """\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00" testTime="2011-01-02T12:05:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="First scenario" testStatus="pass">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
      <scenario name="Second scenario" testStatus="mismatch">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
    </story>
    <story id="S2" title="Second story" points="3" requirementStatus="closed" requirementResolution="fixed" priority="high"/>
  </epic>
  <epic id="E2" title="Second epic"/>
</requirementscatalogue>""".strip())
Exemple #29
0
    class Scenario(Scenario):
        @given(u"A requirements catalogue containing user requirements")
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(
                project="Test project",
                extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1",
                           "First story",
                           points=3,
                           status="open",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2",
                           "Second story",
                           points=3,
                           status="closed",
                           resolution="fixed",
                           priority="high",
                           epic=epic1)
            epic1.stories.append(story2)

            text = """\
Background:
Given some background
  And more background

Scenario: First scenario
Given something
When something happens
Then do something
  And something else
  But not this

Scenario: Second scenario
Given something
When something happens
Then do something
  And something else
"""
            appendScenarios(story1, text)

        @when(u"The serialize() method is called")
        def when(self):
            self.tree = self.catalogue.serialize()

        @then(u"An XML tree is output containing all epics, stories "
              u"with background and scenarios")
        def then(self):
            self.assertEqual(
                lxml.etree.tostring(self.tree, pretty_print=True).strip(), """\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <given>some background</given>
      <given>more background</given>
      <scenario name="First scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>something else</then>
        <then>not this</then>
      </scenario>
      <scenario name="Second scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>something else</then>
      </scenario>
    </story>
    <story id="S2" title="Second story" points="3" requirementStatus="closed" requirementResolution="fixed" priority="high"/>
  </epic>
  <epic id="E2" title="Second epic"/>
</requirementscatalogue>""".strip())
Exemple #30
0
    class Scenario(Scenario):
        @given(u"A requirements catalogue containing user requirements")
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(
                project="Test project", extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0)
            )

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1", "First story", points=3, status="open", priority="high", epic=epic1)
            epic1.stories.append(story1)

            story2 = Story(
                "S2", "Second story", points=3, status="closed", resolution="fixed", priority="high", epic=epic1
            )
            epic1.stories.append(story2)

            text = """\
Background:
Given some background
  And more background

Scenario: First scenario
Given something
When something happens
Then do something
  And something else
  But not this

Scenario: Second scenario
Given something
When something happens
Then do something
  And something else
"""
            appendScenarios(story1, text)

        @when(u"The serialize() method is called")
        def when(self):
            self.tree = self.catalogue.serialize()

        @then(u"An XML tree is output containing all epics, stories " u"with background and scenarios")
        def then(self):
            self.assertEqual(
                lxml.etree.tostring(self.tree, pretty_print=True).strip(),
                """\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <given>some background</given>
      <given>more background</given>
      <scenario name="First scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>something else</then>
        <then>not this</then>
      </scenario>
      <scenario name="Second scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>something else</then>
      </scenario>
    </story>
    <story id="S2" title="Second story" points="3" requirementStatus="closed" requirementResolution="fixed" priority="high"/>
  </epic>
  <epic id="E2" title="Second epic"/>
</requirementscatalogue>""".strip(),
            )
Exemple #31
0
 def serialize(self):
     from corejet.core.model import RequirementsCatalogue
     self.catalogue = RequirementsCatalogue()
     with open(os.path.join(self.tmpdir, 'input.xml'), 'r') as f:
         self.catalogue.populate(f)
Exemple #32
0
    class Scenario(Scenario):

        @given(u"A requirements catalogue containing user requirements")
        def given(self):
            from corejet.core.model import RequirementsCatalogue, Epic, Story

            self.catalogue = RequirementsCatalogue(project="Test project",
                    extractTime=datetime.datetime(2011, 1, 2, 12, 1, 0))

            epic1 = Epic("E1", "First epic")
            self.catalogue.epics.append(epic1)

            epic2 = Epic("E2", "Second epic")
            self.catalogue.epics.append(epic2)

            story1 = Story("S1", "First story", points=3, status="open",
                priority="high", epic=epic1)
            epic1.stories.append(story1)

            story2 = Story("S2", "Second story", points=3, status="closed",
                resolution="fixed", priority="high", epic=epic1)
            epic1.stories.append(story2)

            text = """\
Scenario Outline: Count some apples
Given I have <Start amount> apples
When I get <Red> red and <Green> green apples more
Then I have a total of <Sum> apples

Examples:
| Start amount | Red | Green | Sum |
| 2            | 3   | 4     | 9   |
| 3            | 4   | 5     | 12  |
"""
            appendScenarios(story1, text)

        @when(u"The serialize() method is called")
        def when(self):
            self.tree = self.catalogue.serialize()

        @then(u"An XML tree is output containing all epics, stories "
              u"and scenarios")
        def then(self):
            self.assertEqual(
                lxml.etree.tostring(self.tree, pretty_print=True).strip(), """\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="Count some apples #01">
        <given>I have 2 apples</given>
        <when>I get 3 red and 4 green apples more</when>
        <then>I have a total of 9 apples</then>
      </scenario>
      <scenario name="Count some apples #02">
        <given>I have 3 apples</given>
        <when>I get 4 red and 5 green apples more</when>
        <then>I have a total of 12 apples</then>
      </scenario>
    </story>
    <story id="S2" title="Second story" points="3" requirementStatus="closed" requirementResolution="fixed" priority="high"/>
  </epic>
  <epic id="E2" title="Second epic"/>
</requirementscatalogue>""".strip())
Exemple #33
0
 def serialize(self):
     from corejet.core.model import RequirementsCatalogue
     self.catalogue = RequirementsCatalogue()
     with open(os.path.join(self.tmpdir, 'input.xml'), 'r') as f:
         self.catalogue.populate(f)
Exemple #34
0
    class RequirementsExtract(Scenario):
        @given("A requirements catalogue file extracted with requirements")
        def create(self):
            with open(os.path.join(self.tmpdir, 'input.xml'), 'w') as f:
                f.write("""\
<requirementscatalogue project="Test project" extractTime="2011-01-02T12:01:00">
  <epic id="E1" title="First epic">
    <story id="S1" title="First story" points="3" requirementStatus="open" priority="high">
      <scenario name="First scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
      <scenario name="Second scenario">
        <given>something</given>
        <when>something happens</when>
        <then>do something</then>
        <then>and something else</then>
      </scenario>
    </story>
    <story id="S2" title="Second story" points="3" requirementStatus="closed" requirementResolution="fixed" priority="high"/>
  </epic>
  <epic id="E2" title="Second epic"/>
</requirementscatalogue>
""")

        @when("The populate() method is called")
        def serialize(self):
            from corejet.core.model import RequirementsCatalogue
            self.catalogue = RequirementsCatalogue()
            with open(os.path.join(self.tmpdir, 'input.xml'), 'r') as f:
                self.catalogue.populate(f)

        @then("A minimal requirements catalogue is built")
        def checkInput(self):
            self.assertEqual(self.catalogue.extractTime,
                             datetime.datetime(2011, 1, 2, 12, 1, 0))
            self.assertEqual(self.catalogue.testTime, None)
            self.assertEqual(self.catalogue.project, "Test project")
            self.assertEqual(len(self.catalogue.epics), 2)

            self.assertEqual(self.catalogue.epics[0].name, "E1")
            self.assertEqual(self.catalogue.epics[0].title, "First epic")
            self.assertEqual(len(self.catalogue.epics[0].stories), 2)

            self.assertEqual(self.catalogue.epics[1].name, "E2")
            self.assertEqual(self.catalogue.epics[1].title, "Second epic")
            self.assertEqual(len(self.catalogue.epics[1].stories), 0)

            self.assertEqual(self.catalogue.epics[0].stories[0].name, "S1")
            self.assertEqual(self.catalogue.epics[0].stories[0].title,
                             "First story")
            self.assertEqual(self.catalogue.epics[0].stories[0].points, 3)
            self.assertEqual(self.catalogue.epics[0].stories[0].status, "open")
            self.assertEqual(self.catalogue.epics[0].stories[0].resolution,
                             None)
            self.assertEqual(self.catalogue.epics[0].stories[0].priority,
                             "high")
            self.assertEqual(len(self.catalogue.epics[0].stories[0].scenarios),
                             2)

            self.assertEqual(self.catalogue.epics[0].stories[1].name, "S2")
            self.assertEqual(self.catalogue.epics[0].stories[1].title,
                             "Second story")
            self.assertEqual(self.catalogue.epics[0].stories[1].points, 3)
            self.assertEqual(self.catalogue.epics[0].stories[1].status,
                             "closed")
            self.assertEqual(self.catalogue.epics[0].stories[1].resolution,
                             "fixed")
            self.assertEqual(self.catalogue.epics[0].stories[1].priority,
                             "high")
            self.assertEqual(len(self.catalogue.epics[0].stories[1].scenarios),
                             0)

            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[0].name,
                "First scenario")
            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[0].status, None)
            self.assertEqual(
                len(self.catalogue.epics[0].stories[0].scenarios[0].givens), 1)
            self.assertEqual(
                len(self.catalogue.epics[0].stories[0].scenarios[0].whens), 1)
            self.assertEqual(
                len(self.catalogue.epics[0].stories[0].scenarios[0].thens), 2)

            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[1].name,
                "Second scenario")
            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[1].status, None)
            self.assertEqual(
                len(self.catalogue.epics[0].stories[0].scenarios[1].givens), 1)
            self.assertEqual(
                len(self.catalogue.epics[0].stories[0].scenarios[1].whens), 1)
            self.assertEqual(
                len(self.catalogue.epics[0].stories[0].scenarios[1].thens), 2)

            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[0].givens[0].text,
                "something")
            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[0].whens[0].text,
                "something happens")
            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[0].thens[0].text,
                "do something")
            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[0].thens[1].text,
                "and something else")

            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[1].givens[0].text,
                "something")
            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[1].whens[0].text,
                "something happens")
            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[1].thens[0].text,
                "do something")
            self.assertEqual(
                self.catalogue.epics[0].stories[0].scenarios[1].thens[1].text,
                "and something else")