Automated Testing

Automated Testing

with Python, Django, Selenium and Typescript @ DrChrono in 2021

test (noun)

a procedure intended to establish the quality, performance, or reliability of something, especially before it is taken into widespread use.

# test.py import unittest class TestStringMethods(unittest.TestCase): def test_upper(self): self.assertEqual('foo'.upper(), 'FOO') def test_isupper(self): self.assertTrue('FOO'.isupper()) self.assertFalse('Foo'.isupper())Dustins-MBP:~ dustinalandzes$ python test.py .. ---------------------------------------------------------------------- Ran 2 tests in 0.000s OK# test.py

import unittest

class TestStringMethods(unittest.TestCase):

def test_purposefully_fail(self):
self.assertTrue(False) # this will always fail
Dustins-MBP:~ dustinalandzes$ python test.py .F. ====================================================================== FAIL: test_purposefully_fail (__main__.TestStringMethods) ---------------------------------------------------------------------- Traceback (most recent call last): File "test.py", line 13, in test_purposefully_fail self.assertTrue(False) AssertionError: False is not true ---------------------------------------------------------------------- Ran 3 tests in 0.000s FAILED (failures=1)

CircleCI runs our tests every time we create a Pull Request, and they are required to pass

should we try to achieve 100% test coverage?

Our "end to end" tests use Selenium, a browser automation framework, and are maintained by Zuci Systems.


Selenium "End to end" test for Sign Up and Login ts_002

How much testing / test coverage is economical?

  1. The problem is not that we don’t know how to write correct software. The problem is that correct software is too expensive.
  2. The amount of testing required is different for every businesses what is the impact of failure (does the plane crash?)
  3. https://hypothesis.works/articles/economics-of-software-correctness/

SpaceX's Dragon Crew Displays use Chromium, Javascript, HTML, CSS