def test_func_fullname(): """ >>> def test_func_fullname_example1(): ... pass >>> def test_func_fullname_example2(): ... pass >>> def test_func_fullname_example3(): ... pass """ allure_report = run_docstring_example()
def test_passed_status(self): """ >>> import unittest >>> class TestStatusExample(unittest.TestCase): ... def test_passed_example(self): ... assert True """ allure_report = run_docstring_example() assert_that( allure_report, has_test_case("test_passed_example", with_status("passed")))
def test_func_fullname(): """ >>> def test_func_fullname_example(): ... pass """ allure_report = run_docstring_example() assert_that( allure_report, has_property( "test_cases", has_item( has_entry("fullName", "example_module.test_func_fullname_example"))))
def test_func_label(): """ >>> import allure >>> @allure.epic("Label", "Bdd") ... @allure.feature("Function label") ... def test_func_label_example(): ... pass """ allure_report = run_docstring_example() assert_that( allure_report, has_test_case("test_func_label_example", has_epic("Label"), has_epic("Bdd"), has_feature("Function label")))
def test_skipped_status(self): """ >>> import unittest >>> class TestStatusExample(unittest.TestCase): ... def test_skipped_example(self): ... self.skipTest('my skip reason') """ allure_report = run_docstring_example() assert_that( allure_report, has_test_case( "test_skipped_example", with_status("skipped"), has_status_details(with_message_contains("my skip reason"))))
def test_broken_status(self): """ >>> import unittest >>> class TestStatusExample(unittest.TestCase): ... def test_broken_example(self): ... raise Exception("my error") """ allure_report = run_docstring_example() assert_that( allure_report, has_test_case( "test_broken_example", with_status("broken"), has_status_details(with_message_contains("my error"))))
def test_failed_status(self): """ >>> import unittest >>> class TestStatusExample(unittest.TestCase): ... def test_failed_example(self): ... assert False, "my message" """ allure_report = run_docstring_example() assert_that( allure_report, has_test_case( "test_failed_example", with_status("failed"), has_status_details(with_message_contains("my message"))))
def test_method_label(self): """ >>> import unittest >>> import allure >>> class TestBDDLabelExample(unittest.TestCase): ... @allure.epic("Label", "Bdd") ... @allure.feature("Method label") ... def test_method_label_example(self): ... pass """ allure_report = run_docstring_example() assert_that( allure_report, has_test_case("test_method_label_example", has_epic("Label"), has_epic("Bdd"), has_feature("Method label")))
def test_parametrized_func(first, second): """ >>> from nose2.tools import params >>> @params(("hello", 42), ("world", 777)) ... def test_parametrized_func_example(alpha, betta): ... pass """ first_param_name, first_param_value = first second_param_name, second_param_value = second allure_report = run_docstring_example() assert_that( allure_report, has_test_case( "test_parametrized_func_example", has_parameter(first_param_name, represent(first_param_value)), has_parameter(second_param_name, represent(second_param_value))))
def test_method_fullname(self): """ >>> import unittest >>> class TestFullnameExample(unittest.TestCase): ... def test_method_fullname_example(self): ... pass """ allure_report = run_docstring_example() assert_that( allure_report, has_property( "test_cases", has_item( has_entry( "fullName", "example_module.TestFullnameExample.test_method_fullname_example" ))))
def test_parametrized_method(self, first, second): """ >>> import unittest >>> from nose2.tools import params >>> class TestParametrizedExample(unittest.TestCase): ... @params(({"hello": 4}, [4, 2]), ({"wold": 2}, [7, 7, 7])) ... def test_parametrized_method_example(self, bravo, charlie): ... pass """ first_param_name, first_param_value = first second_param_name, second_param_value = second allure_report = run_docstring_example() assert_that( allure_report, has_test_case( "test_parametrized_method_example", has_parameter(first_param_name, represent(first_param_value)), has_parameter(second_param_name, represent(second_param_value))))