Open ross-morrison opened 2 years ago
For basic unit tests we can just use the built in unittest library.
Tests should be created in the tests
directory.
Every test should append the src
directory to the sys.path
.
import sys
import os.path
sys.path.append(os.path.join(sys.path[0], '../src'))
To create a test class, inherit from the unittest.TestCase
class
class TestExampleClass(unittest.TestCase):
To ensure tests can be run by simple running the test file add the following
if __name__ == '__main__':
unittest.main()
More research should be done with regard to writing tests for GUI code: https://towardsdatascience.com/automate-ui-testing-with-pyautogui-in-python-4a3762121973