Пример #1
0
def test_see_summary_for_fixture_returns_proper_string_for_failed_tests():

    mocker = Mocker()

    expected = """================
Test Run Summary
================

Status: FAILED

Test Data Stats
---------------
Successful Stories......0/1 (0.00%)
Failed Stories..........1/1 (100.00%)
Successful Scenarios....0/1 (0.00%)
Failed Scenarios........1/1 (100.00%)"""

    template_loader_mock = mocker.mock()
    template_loader_mock.load("summary")
    mocker.result(summary_template)

    with mocker:
        settings = Settings()
        fixture = Fixture()
        action = some_action()
        fixture.append_story(action.scenario.story)
        action.mark_as_failed()
        result = Result(fixture=fixture, template_loader=template_loader_mock)

        summary = result.summary_for(settings.default_culture)
        assert summary == expected
Пример #2
0
def test_see_summary_for_fixture_returns_proper_string():
    expected = """================
Test Run Summary
================

Status: SUCCESSFUL

Test Data Stats
---------------
Successful Stories......1/1 (100.00%)
Failed Stories..........0/1 (0.00%)
Successful Scenarios....1/1 (100.00%)
Failed Scenarios........0/1 (0.00%)"""

    template_loader_mock = Mock()
    template_loader_mock.expects(once()) \
                        .load(eq("summary")) \
                        .will(return_value(summary_template))
    settings = Settings()
    fixture = Fixture()
    action = some_action()
    fixture.append_story(action.scenario.story)
    action.mark_as_successful()
    result = Result(fixture=fixture, template_loader=template_loader_mock)

    summary = result.summary_for(settings.default_culture)
    assert summary == expected
Пример #3
0
def test_see_summary_for_fixture_returns_proper_string_for_no_tests():

    mocker = Mocker()

    expected = """================
Test Run Summary
================

Status: UNKNOWN

Test Data Stats
---------------
Successful Stories......0/0 (0.00%)
Failed Stories..........0/0 (0.00%)
Successful Scenarios....0/0 (0.00%)
Failed Scenarios........0/0 (0.00%)"""

    template_loader_mock = mocker.mock()
    template_loader_mock.load("summary")
    mocker.result(summary_template)

    with mocker:
        settings = Settings()
        fixture = Fixture()
        result = Result(fixture=fixture, template_loader=template_loader_mock)

        summary = result.summary_for(settings.default_culture)
        assert summary == expected
Пример #4
0
def test_see_summary_for_fixture_returns_proper_string_for_no_tests():
    
    mocker = Mocker()
    
    expected = """================
Test Run Summary
================

Status: UNKNOWN

Test Data Stats
---------------
Successful Stories......0/0 (0.00%)
Failed Stories..........0/0 (0.00%)
Successful Scenarios....0/0 (0.00%)
Failed Scenarios........0/0 (0.00%)"""

    template_loader_mock = mocker.mock()
    template_loader_mock.load("summary")
    mocker.result(summary_template)
    
    with mocker:
        settings = Settings()
        fixture = Fixture()
        result = Result(fixture=fixture, template_loader=template_loader_mock)
    
        summary = result.summary_for(settings.default_culture)
        assert summary == expected
Пример #5
0
def test_see_summary_for_fixture_returns_proper_string_for_failed_tests():
    
    mocker = Mocker()
    
    expected = """================
Test Run Summary
================

Status: FAILED

Test Data Stats
---------------
Successful Stories......0/1 (0.00%)
Failed Stories..........1/1 (100.00%)
Successful Scenarios....0/1 (0.00%)
Failed Scenarios........1/1 (100.00%)"""

    template_loader_mock = mocker.mock()
    template_loader_mock.load("summary")
    mocker.result(summary_template)
    
    with mocker:
        settings = Settings()
        fixture = Fixture()
        action = some_action()
        fixture.append_story(action.scenario.story)
        action.mark_as_failed()
        result = Result(fixture=fixture, template_loader=template_loader_mock)
    
        summary = result.summary_for(settings.default_culture)
        assert summary == expected
Пример #6
0
def test_see_summary_for_fixture():
    template_loader_mock = Mock()
    template_loader_mock.expects(once()) \
                        .load(eq("summary")) \
                        .will(return_value(summary_template))
    settings = Settings()
    fixture = Fixture()
    action = some_action()
    fixture.append_story(action.scenario.story)
    action.mark_as_successful()
    result = Result(fixture=fixture, template_loader=template_loader_mock)

    summary = result.summary_for(settings.default_culture)
    assert summary is not None
Пример #7
0
def test_see_summary_for_fixture_returns_proper_failed_scenarios_string():

    mocker = Mocker()

    expected = """================
Test Run Summary
================

Status: FAILED

Test Data Stats
---------------
Successful Stories......0/1 (0.00%)
Failed Stories..........1/1 (100.00%)
Successful Scenarios....0/1 (0.00%)
Failed Scenarios........1/1 (100.00%)

Failed Stories / Scenarios
--------------------------
Story..........As a Someone I want to Do Something So that I'm Happy
Story file.....To be implemented.
Scenario.......1 - Something
    Given
        I did something - UNKNOWN
    When
        I do something - UNKNOWN
    Then
        Something happens - FAILED - Something very bad happened
"""

    template_loader_mock = mocker.mock()
    template_loader_mock.load("summary")
    mocker.result(summary_template + summary_template_failed_stories)

    with mocker:
        settings = Settings()
        fixture = Fixture()
        result = Result(fixture=fixture, template_loader=template_loader_mock)
        action = complete_scenario_with_then_action_returned()
        fixture.append_story(action.scenario.story)
        action.mark_as_failed("Something very bad happened")

        summary = result.summary_for(settings.default_culture)

        assert summary.strip() == expected.strip()
Пример #8
0
def test_see_summary_for_fixture_returns_proper_failed_scenarios_string():
    
    mocker = Mocker()
    
    expected = """================
Test Run Summary
================

Status: FAILED

Test Data Stats
---------------
Successful Stories......0/1 (0.00%)
Failed Stories..........1/1 (100.00%)
Successful Scenarios....0/1 (0.00%)
Failed Scenarios........1/1 (100.00%)

Failed Stories / Scenarios
--------------------------
Story..........As a Someone I want to Do Something So that I'm Happy
Story file.....To be implemented.
Scenario.......1 - Something
    Given
        I did something - UNKNOWN
    When
        I do something - UNKNOWN
    Then
        Something happens - FAILED - Something very bad happened
"""

    template_loader_mock = mocker.mock()
    template_loader_mock.load("summary")
    mocker.result(summary_template + summary_template_failed_stories)
    
    with mocker:
        settings = Settings()
        fixture = Fixture()
        result = Result(fixture=fixture, template_loader=template_loader_mock)
        action = complete_scenario_with_then_action_returned()
        fixture.append_story(action.scenario.story)
        action.mark_as_failed("Something very bad happened")
    
        summary = result.summary_for(settings.default_culture)
    
        assert summary.strip() == expected.strip()
Пример #9
0
def test_see_summary_for_fixture():

    mocker = Mocker()

    template_loader_mock = mocker.mock()
    template_loader_mock.load("summary")
    mocker.result(summary_template)

    with mocker:
        settings = Settings()
        fixture = Fixture()
        action = some_action()
        fixture.append_story(action.scenario.story)
        action.mark_as_successful()
        result = Result(fixture=fixture, template_loader=template_loader_mock)

        summary = result.summary_for(settings.default_culture)
        assert summary is not None
Пример #10
0
def test_see_summary_for_fixture():
    
    mocker = Mocker()
    
    template_loader_mock = mocker.mock()
    template_loader_mock.load("summary")
    mocker.result(summary_template)
    
    with mocker:
        settings = Settings()
        fixture = Fixture()
        action = some_action()
        fixture.append_story(action.scenario.story)
        action.mark_as_successful()
        result = Result(fixture=fixture, template_loader=template_loader_mock)
    
        summary = result.summary_for(settings.default_culture)
        assert summary is not None
Пример #11
0
def test_see_summary_for_fixture_returns_proper_failed_scenarios_string():
    expected = u"""================
Test Run Summary
================
Status: FAILED

Test Data Stats
---------------
Successful Stories......0 of 1 (0.00%)
Successful Scenarios....0 of 1 (0.00%)
Failed Stories..........1 of 1 (100.00%)
Failed Scenarios........1 of 1 (100.00%)

Total timing: 0.00 secs
Scenarios/Minute: 0 scenarios per minute


Failed Stories / Scenarios
--------------------------
Story..........As a Someone I want to Do Something So that I'm Happy
Story file.....some file
Scenario.......1 - Something
    Given
        I did something - UNKNOWN
    When
        I do something - UNKNOWN
    Then
        Something happens - FAILED - Something very bad happened
"""

    settings = Settings()
    fixture = Fixture()
    result = Result(fixture=fixture)
    action = complete_scenario_with_then_action_returned()
    fixture.append_story(action.scenario.story)
    action.mark_as_failed("Something very bad happened")

    summary = re.sub(r'[$][{][^}]+[}]', '', result.summary_for("en-us"))

    assert summary.strip() == expected.strip(), compare(
        summary.strip(), expected.strip())
Пример #12
0
def test_see_summary_for_fixture_returns_proper_failed_scenarios_string():
    expected = u"""================
Test Run Summary
================
Status: FAILED

Test Data Stats
---------------
Successful Stories......0 of 1 (0.00%)
Successful Scenarios....0 of 1 (0.00%)
Failed Stories..........1 of 1 (100.00%)
Failed Scenarios........1 of 1 (100.00%)

Total timing: 0.00 secs
Scenarios/Minute: 0 scenarios per minute


Failed Stories / Scenarios
--------------------------
Story..........As a Someone I want to Do Something So that I'm Happy
Story file.....some file
Scenario.......1 - Something
    Given
        I did something - UNKNOWN
    When
        I do something - UNKNOWN
    Then
        Something happens - FAILED - Something very bad happened
"""

    settings = Settings()
    fixture = Fixture()
    result = Result(fixture=fixture)
    action = complete_scenario_with_then_action_returned()
    fixture.append_story(action.scenario.story)
    action.mark_as_failed("Something very bad happened")

    summary = re.sub(r'[$][{][^}]+[}]', '', result.summary_for("en-us"))

    assert summary.strip() == expected.strip(), compare(summary.strip(), expected.strip())
Пример #13
0
def test_see_summary_for_fixture_returns_proper_string_for_no_tests():
    expected = """================
Test Run Summary
================

Status: UNKNOWN

Test Data Stats
---------------
Successful Stories......0/0 (0.00%)
Failed Stories..........0/0 (0.00%)
Successful Scenarios....0/0 (0.00%)
Failed Scenarios........0/0 (0.00%)"""

    template_loader_mock = Mock()
    template_loader_mock.expects(once()) \
                        .load(eq("summary")) \
                        .will(return_value(summary_template))
    settings = Settings()
    fixture = Fixture()
    result = Result(fixture=fixture, template_loader=template_loader_mock)

    summary = result.summary_for(settings.default_culture)
    assert summary == expected