How to test a function that is using user-interface How to test a function that is using user-interface tkinter tkinter

How to test a function that is using user-interface


Usually one fills the user input beforehand with expected or special values and then calls the test function several times. Also you may simulate clicks with various tools.

In C++ you could do something like:

int number_of_tests = 10;int tests_passed = 0;tests_passed += my_test_function_int(0);tests_passed += my_test_function_int(-1);...tests_passed += my_test_function_string("foo");tests_passed += my_test_function_string("");tests_passed += my_test_function_string(" ");...return (tests_passed == number_of_tests); 

This is just an example how one can do it (in our company we do it this way).Also it is not very hard to add new tests for non-programmers or new people.