本文整理汇总了Python中pyccuracy.fixture.Fixture类的典型用法代码示例。如果您正苦于以下问题:Python Fixture类的具体用法?Python Fixture怎么用?Python Fixture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Fixture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_append_story_keeps_data
def test_append_story_keeps_data():
fixture = Fixture()
story = Story("some", "other", "data", identity="Some File")
fixture.append_story(story)
assert fixture.stories[0].as_a == "some"
assert fixture.stories[0].i_want_to == "other"
assert fixture.stories[0].so_that == "data"
开发者ID:heynemann,项目名称:pyccuracy,代码行数:7,代码来源:test_fixture.py
示例2: test_should_execute_scenarios_successfully
def test_should_execute_scenarios_successfully():
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
fixture.append_story(some_action().scenario.story)
context = Mock()
context.browser_driver = Mock()
context.browser_driver.expects(once()).start_test(eq("http://localhost"))
context.browser_driver.expects(once()).stop_test()
context.settings = Mock()
context.settings.on_before_action = None
context.settings.on_action_successful = None
context.settings.on_action_error = None
context.language = Mock()
context.language \
.expects(once()) \
.get(eq('given')) \
.will(return_value('Given'))
context.language \
.expects(once()) \
.get(eq('when')) \
.will(return_value('When'))
context.language \
.expects(once()) \
.get(eq('then')) \
.will(return_value('Then'))
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert fixture.get_status() == Status.Successful
context.verify()
context.browser_driver.verify()
开发者ID:andrewsmedina,项目名称:pyccuracy,代码行数:33,代码来源:test_story_runner.py
示例3: test_fixture_returns_proper_status_if_action_succeeded
def test_fixture_returns_proper_status_if_action_succeeded():
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.mark_as_successful()
assert fixture.get_status() == Status.Successful
开发者ID:heynemann,项目名称:pyccuracy,代码行数:7,代码来源:test_fixture.py
示例4: test_see_summary_for_fixture_returns_proper_string
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
开发者ID:andrewsmedina,项目名称:pyccuracy,代码行数:27,代码来源:test_result.py
示例5: test_should_handle_action_errors_successfully
def test_should_handle_action_errors_successfully():
mocker = Mocker()
def action_failed_method(context, *args, **kwargs):
raise ActionFailedError("bla")
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.execute_function = action_failed_method
context = Object()
context.browser_driver = mocker.mock()
context.browser_driver.start_test("http://localhost")
context.browser_driver.stop_test()
context.settings = mocker.mock()
context.settings.on_before_action
mocker.result(None)
context.settings.on_action_error
mocker.result(None)
context.language = mocker.mock()
context.language.get('given')
mocker.result('Given')
with mocker:
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert fixture.get_status() == Status.Failed
开发者ID:Desperado,项目名称:pyccuracy,代码行数:30,代码来源:test_story_runner.py
示例6: test_story_runner_returns_a_result_with_the_original_Fixture
def test_story_runner_returns_a_result_with_the_original_Fixture():
settings = Settings()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
runner = StoryRunner()
context = Mock()
context.browser_driver = Mock()
context.browser_driver.expects(once()).start_test(eq("http://localhost"))
context.browser_driver.expects(once()).stop_test()
context.settings = Mock()
context.settings.on_before_action = None
context.settings.on_action_successful = None
context.settings.on_action_error = None
context.language = Mock()
context.language \
.expects(once()) \
.get(eq('given')) \
.will(return_value('Given'))
context.language \
.expects(once()) \
.get(eq('when')) \
.will(return_value('When'))
context.language \
.expects(once()) \
.get(eq('then')) \
.will(return_value('Then'))
result = runner.run_stories(settings, fixture, context=context)
assert result.fixture == fixture
context.verify()
context.browser_driver.verify()
开发者ID:andrewsmedina,项目名称:pyccuracy,代码行数:34,代码来源:test_story_runner.py
示例7: test_see_summary_for_fixture_returns_proper_string_for_failed_tests
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
开发者ID:Desperado,项目名称:pyccuracy,代码行数:31,代码来源:test_result.py
示例8: test_story_runner_returns_a_result_with_the_original_Fixture
def test_story_runner_returns_a_result_with_the_original_Fixture():
mocker = Mocker()
settings = Settings()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
runner = StoryRunner()
context = Object()
context.browser_driver = mocker.mock()
context.browser_driver.start_test("http://localhost")
context.browser_driver.stop_test()
context.settings = mocker.mock()
context.settings.on_before_action
mocker.result(None)
context.settings.on_action_successful
mocker.result(None)
context.language = mocker.mock()
context.language.get('given')
mocker.result('Given')
context.language.get('when')
mocker.result('When')
context.language.get('then')
mocker.result('Then')
with mocker:
result = runner.run_stories(settings, fixture, context=context)
assert result.fixture == fixture
开发者ID:Desperado,项目名称:pyccuracy,代码行数:32,代码来源:test_story_runner.py
示例9: test_should_catch_assertion_error
def test_should_catch_assertion_error():
mocker = Mocker()
def action_failed_method(context, *args, **kwargs):
assert False, "bla"
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.execute_function = action_failed_method
context = Object()
context.browser_driver = mocker.mock()
context.browser_driver.start_test("http://localhost")
context.browser_driver.stop_test()
context.settings = mocker.mock()
context.settings.on_before_action
mocker.result(None)
context.settings.on_action_error
mocker.result(None)
context.language = mocker.mock()
context.language.get('given')
mocker.result('Given')
with mocker:
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert isinstance(action.error, AssertionError)
assert action.error.message == "bla"
开发者ID:Desperado,项目名称:pyccuracy,代码行数:31,代码来源:test_story_runner.py
示例10: test_should_execute_scenarios_successfully
def test_should_execute_scenarios_successfully():
mocker = Mocker()
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
fixture.append_story(some_action().scenario.story)
context = Object()
context.browser_driver = mocker.mock()
context.browser_driver.start_test("http://localhost")
context.browser_driver.stop_test()
context.settings = mocker.mock()
context.settings.on_before_action
mocker.result(None)
context.settings.on_action_successful
mocker.result(None)
context.language = mocker.mock()
context.language.get('given')
mocker.result('Given')
context.language.get('when')
mocker.result('When')
context.language.get('then')
mocker.result('Then')
with mocker:
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert fixture.get_status() == Status.Successful
开发者ID:Desperado,项目名称:pyccuracy,代码行数:31,代码来源:test_story_runner.py
示例11: test_reset_clears_lists
def test_reset_clears_lists():
fixture = Fixture()
fixture.invalid_test_files.append("some")
fixture.no_story_header.append("some")
fixture.stories.append("some")
fixture.clear()
assert len(fixture.invalid_test_files) == 0
assert len(fixture.no_story_header) == 0
assert len(fixture.stories) == 0
开发者ID:heynemann,项目名称:pyccuracy,代码行数:11,代码来源:test_fixture.py
示例12: test_see_summary_for_fixture
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
开发者ID:andrewsmedina,项目名称:pyccuracy,代码行数:14,代码来源:test_result.py
示例13: test_should_execute_scenarios_successfully
def test_should_execute_scenarios_successfully():
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
fixture.append_story(some_action().scenario.story)
context = Mock()
context.browser_driver = Mock()
context.browser_driver.expects(once()).start_test(eq("http://localhost"))
context.browser_driver.expects(once()).stop_test()
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert fixture.get_status() == Status.Successful
context.verify()
context.browser_driver.verify()
开发者ID:guilhermechapiewski,项目名称:pyccuracy,代码行数:16,代码来源:test_story_runner.py
示例14: test_story_runner_returns_a_result_with_the_original_Fixture
def test_story_runner_returns_a_result_with_the_original_Fixture():
settings = Settings()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
runner = StoryRunner()
context = Mock()
context.browser_driver = Mock()
context.browser_driver.expects(once()).start_test(eq("http://localhost"))
context.browser_driver.expects(once()).stop_test()
result = runner.run_stories(settings, fixture, context=context)
assert result.fixture == fixture
context.verify()
context.browser_driver.verify()
开发者ID:guilhermechapiewski,项目名称:pyccuracy,代码行数:17,代码来源:test_story_runner.py
示例15: test_see_summary_for_fixture_returns_proper_failed_scenarios_string
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()
开发者ID:Desperado,项目名称:pyccuracy,代码行数:45,代码来源:test_result.py
示例16: test_see_summary_for_fixture
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
开发者ID:Desperado,项目名称:pyccuracy,代码行数:18,代码来源:test_result.py
示例17: test_should_handle_action_errors_successfully
def test_should_handle_action_errors_successfully():
def action_failed_method(context, *args, **kwargs):
raise ActionFailedError("bla")
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.execute_function = action_failed_method
context = Mock()
context.browser_driver = Mock()
context.browser_driver.expects(once()).start_test(eq("http://localhost"))
context.browser_driver.expects(once()).stop_test()
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert fixture.get_status() == Status.Failed
context.verify()
context.browser_driver.verify()
开发者ID:guilhermechapiewski,项目名称:pyccuracy,代码行数:20,代码来源:test_story_runner.py
示例18: test_should_record_errors_correctly
def test_should_record_errors_correctly():
def action_failed_method(context, *args, **kwargs):
raise ActionFailedError("bla")
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.execute_function = action_failed_method
context = Mock()
context.browser_driver = Mock()
context.browser_driver.expects(once()).start_test(eq("http://localhost"))
context.browser_driver.expects(once()).stop_test()
context.settings = Mock()
context.settings.on_before_action = None
context.settings.on_action_successful = None
context.settings.on_action_error = None
context.language = Mock()
context.language \
.expects(once()) \
.get(eq('given')) \
.will(return_value('Given'))
context.language \
.expects(once()) \
.get(eq('when')) \
.will(return_value('When'))
context.language \
.expects(once()) \
.get(eq('then')) \
.will(return_value('Then'))
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert isinstance(action.error, ActionFailedError)
assert action.error.message == "bla"
context.verify()
context.browser_driver.verify()
开发者ID:andrewsmedina,项目名称:pyccuracy,代码行数:39,代码来源:test_story_runner.py
示例19: test_should_record_errors_correctly
def test_should_record_errors_correctly():
def action_failed_method(context, *args, **kwargs):
raise ActionFailedError("bla")
settings = Settings()
runner = StoryRunner()
fixture = Fixture()
action = some_action()
fixture.append_story(action.scenario.story)
action.execute_function = action_failed_method
context = Mock()
context.browser_driver = Mock()
context.browser_driver.expects(once()).start_test(eq("http://localhost"))
context.browser_driver.expects(once()).stop_test()
result = runner.run_stories(settings=settings, fixture=fixture, context=context)
assert isinstance(action.error, ActionFailedError)
assert action.error.message == "bla"
context.verify()
context.browser_driver.verify()
开发者ID:guilhermechapiewski,项目名称:pyccuracy,代码行数:22,代码来源:test_story_runner.py
示例20: get_stories
def get_stories(self, settings):
if not self.language:
self.language = LanguageGetter(settings.default_culture)
fixture = Fixture()
story_file_list = self.file_object.list_files(directories=settings.tests_dirs, pattern=settings.file_pattern)
story_file_list.sort()
for story_file_path in story_file_list:
try:
parsed, error, story = self.parse_story_file(story_file_path, settings)
if parsed:
fixture.append_story(story)
else:
fixture.append_no_story_header(story_file_path)
except IOError, err:
fixture.append_invalid_test_file(story_file_path, err)
except InvalidScenarioError, verr:
fixture.append_no_story_header(story_file_path)
开发者ID:rootart,项目名称:pyccuracy,代码行数:20,代码来源:parsers.py
注:本文中的pyccuracy.fixture.Fixture类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论