# test_Chapter8.py # End to End Testing ## Syntax Errors -> Good IDE VS Code ## Init and Runtime Errors Exit Code 1 at runtime __init__ entrypoint issue ## Exception Errors -> Errors AFTER runtime that cause Exit Code 1 -> try except 'finally' ## UI/UX Testing aka the bouncing ball correct for the user ## Unit Testing -> isolate the class objects and test them individually aka breakpoints ## Assertion Testing -> Actual vs Expected Results Assert Class pytest # pytest uses the assert object # pip install pytest import pytest # test for api to calc $40 # test data mockito 'mock' examples to test results def calc_add(x,y,z): #7,3,4 19 | 40 return (x + y) * z def test_addition1(): result = calc_add(7,3,'4') # fail data type error int/str assert result == 40 def test_addition2(): result = calc_add(7,3,4) assert result == 40 # pass actual 40 == expected 40 # ps > pytest filename.py --resultlog=logfilename.txt