# test_main.py from unittest import TestCase from main import * class TestMain(TestCase): def test_function_1(self): # Here the sample code need to write.
# test_case_main.py
class TestCaseMain:
def case1(self):
"""
Each test cases having function name case with case count
returns test_case, expected_value, comment
Each test case there might be a reason for failing, if you sure
what it is, then you can give comment as case1: reason for failing.
"""
sample_test_case = "some_value"
sample_expected_test_case = "some_expected_value"
comment = "case1"
return sample_test_case, sample_expected_test_case, comment
def get(self) -> list:
"""
It's a general get() method, every test_case class should have
returns list of test case
"""
case_array = []
case_array.append(self.case1())
return case_array
# test_main.py from unittest
from unittest import TestCase
from main import *
from test_case.test_case_main import TestCaseMain
class TestMain(TestCase):
def test_function_1(self):
testCaseMain = TestCaseMain()
test_case = testCaseMain()
from sample_test_case, sample_expected_test_case, case in
test_case:
result = function_1(sample_test_case)
self.assertEqual(sample_expected_test_case,
sample_test_case, case)
Comments