There is the following file: SomeTest1.py

__author__ = 'vbilohorodskyi' import unittest from selenium import webdriver from selenium.webdriver.common import keys class InitDriverTest(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() print("=========================================================") #initializing browser and verifying if the selected URL is accessible and has correct content by key values def testInit_driver_and_url(self): driver = self.driver driver.get("somesite.com") assert "Some title" in driver.title print("Init driver and url: PASS") def tearDown(self): self.driver.quit() if __name__ == "__main__": unittest.main() 

And there is a second file with the same architecture, but with a different test case.

Both of these files are in the same Python Package, and run separately without problems. As soon as I try to run all the tests with pekedzha, I observe an error

 Process finished with exit code 0 Empty test suite. 

init.py file for this pekedzha empty.

I tried to change the configuration of Runner, played with the names of classes and methods (test- at the beginning and -Test at the end), tried different Regexps as a pattern in the configuration of Runner, but nothing helped.

Has anyone encountered this problem? I would be grateful for the help in setting up the launch of the pekedzha test suites.

  • And how do you run them? Separate run / debug configuration? Or from the context menu to a file or folder? - Vladimir Obrizan

3 answers 3

This test configuration successfully works for me:

Test Configuration

Settings: "All in folder", specified folder (not package) with tests: tests . No templates specified. The working folder is the folder of the entire project.

Here is the test folder:

Test folder

All files have test_ prefix, all classes are inherited from unittest.TestCase and have prefix Test .

PyCharm Community Edition 5.0.3.

In addition, in your example with tabulations, trouble. if __name__ == "__main__": should not have a tab in front.

    By a couple of attempts, it turned out that there are 2 options for processing all the tests in the catalog:

    1. all test file names start with test_
    2. Do not start a single file name with test_, and specify * .py in the configuration as a pattern

    __init__.py not needed, because unlikely we will import.

      All tests will start, if you follow the rule - files with tests must contain the string “test_” in the name, class names must begin with “Test”, and methods - with the string “test_”.