Unit Testing

Hello! I encountered a problem that prevents me from implementing my product. Everything is fine in the code, but there are still bugs when using it. How can I solve the problem?