⟩ Why the add_action() function does not work in member function in wordpress?
try replacing :
register_widget('test_function');
with:
add_action('widgets_init', register_test_funtion');
function register_test_funtion() {
register_widget('test_funtion');
}