PyCharm 2019.5.2 cannot run test

Hello, I try to run Unittest, but I don't understand what happened:

My code:

import unittest
from selenium import webdriver

class Setup(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome(executable_path = r'C:...')
self.driver.get('.....')

def test_valid_login(self):
driver = self.driver
driver.find_element_by_id('....').send_keys(.....')
driver.find_element_by_id('.....').send_keys('.....')
welcome_text = driver.find_element_by_id('welcome.').text

self.assertEqual('Welcome Admin', welcome_text)

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


Ran 0 tests in 0.000s

OK

Process finished with exit code 0

-------------------------------------------------

But it work on 2018 version. 

 

0
2 comments

Hi, 

Well, first of all in your snippet test_valid_login method is not part of the Setup class, which I hope is just a typo.

If that's not the issue, please provide screenshot of your Unittest run/debug configuration in PyCharm. Maybe you have some tests excluded? Also update the snippet in your OP post so we could exclude this from the suspect list.

0
Avatar
Permanently deleted user

Hello,

I reinstalled Selenium and Unittest. Now all works. 

Thank you.

 

 

0

Please sign in to leave a comment.