TestSuite

Here we are creating TestSuite by using unitTest frameWork and by using test classes of above two file test_ContactUsFormTest.py and test_LoginTest.py

UnitTest is a python inbuilt python test framework.

Follow the below steps to create a TestSuite file and execute it.

  • Import the files which we created under tests packages
  • Create the object of the class using unitTest TestLoader for required test classes
  • Create TestSuite using test class objects
  • Call the Test Runner method by passing created TestSuite name



TestSuite.py

# 1. Import the files
import unittest
import pytest
from AppiumFrameWork.tests.test_LoginTest import LoginTest
from AppiumFrameWork.tests.test_ContactUsFormTest import ContactFormTest

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

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

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

Run command to execute TestSuite File

py.test TestSuite.py

Run command to execute TestSuite File along with allure report

py.test --alluredir=”report_path” TestSuite.py


py.test --alluredir=’/Documents/Skill2Lead/Tutorials/AppiumPython/AppiumFrameWork/reports’ TestSuite.py