TestSuite

Finally we need to create the test suite using unit test which is the inbuilt framework for testing.


Below are the steps to create the test suite.

1. Import the files

2. Create the object of the test class file using unitTest.

3. Create TestSuite using the created objects for test files.

4. Call the Test Runner method by passing the created testsuite name.




TestSuite.py

# 1. Import the files
import unittest
from SeleniumFrameWork.tests.test_ContactFormtest import ContactFormTest
from SeleniumFrameWork.tests.test_EnterTextTest import EnterTextTest


# 2. Create the object of the class using unitTest
cf = unittest.TestLoader().loadTestsFromTestCase(ContactFormTest)
et = unittest.TestLoader().loadTestsFromTestCase(EnterTextTest)


# 3. Create TestSuite
regressionTest = unittest.TestSuite([cf,et])

# 4. Call the Test Runner method
unittest.TextTestRunner(verbosity=1).run(regressionTest)

# Note : All the methods in test files should define in proper run order



Command to execute the testsuite file

pytest TestSuite.py

Command to execute the test file along with allure report.

pytest --alluredir=”Path_to_save_report” TestSuite.py

pytest --alluredir=”/SeleniumFrameWork/reports/allureReports” TestSuite.py