Prompts
Prompt app icon

Unit Test Generator

By Mark
6,561 Users

Create unit tests for any visible function or code block

Prompt

Analyze the function or code block currently visible in the app text, window context, screen contents, or clipboard text. Based on its purpose, parameters, and return values, generate a comprehensive set of unit tests. Include tests for normal cases, edge cases, and potential error conditions. Provide the unit test code in the same programming language as the original function, using a popular testing framework for that language. Explain the purpose of each test and how it contributes to ensuring the function's correctness and robustness. If audio transcripts are available, consider any verbally discussed testing requirements. Tailor your unit tests to the specific programming language and context observed in the available information. If there is no context to work from print "To use me fully, go to your code and move your mouse over the floating Highlight icon."


How it works