On Running the test suite: Runs the test suite shows test passed Notification but displays "Empty Suite"

PanditSK

Here's my code but it shows no Tests found, and prints Empty Suite

import unittest
import time
from selenium import webdriver


class LoginTest(unittest.TestCase):
    driver = webdriver.Chrome(executable_path="C:\\Users\\win\\Desktop\\chromedriver.exe")

    @classmethod
    def setUpClass(cls):
        cls.driver = webdriver.Chrome(executable_path="C:\\Users\\win\\Desktop\\chromedriver.exe")
        cls.driver.implicitly_wait(10)

    def Test(self):
        self.driver.get("https://opensource-demo.orangehrmlive.com/")
        self.driver.find_element_by_id("txtPassword").send_keys("admin123")
        self.driver.find_element_by_id("txtUsername").send_keys("Admin")
        self.driver.find_element_by_id("btnLogin").click()
        time.sleep(2)

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
        cls.driver.quit()
        print("Test Complete")


if __name__ == '__main__':
    unittest.main()

I wrote this code, but on running my Test Suite it displays as follows:

Testing started at 2:47 PM ...
C:\PycharmProject\OrangeHRM\venv\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.3\plugins\python-ce\helpers\pycharm\_jb_unittest_runner.py" --target LoginTest.LoginTest
Launching unittests with arguments python -m unittest LoginTest.LoginTest in C:\PycharmProject\OrangeHRM\ScriptsDemo\Tests



Ran 0 tests in 0.000s

OK

Process finished with exit code 0

No Tests were found

Empty suite
Jose Martínez Poquet

In unittest library exists a naming convention that all the tests start with 'test', this informs the test runner about which methods represent tests.

You have to change your 'Test' method to 'test'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related