Home › Prompts › Coding & Tech › Write Unit Tests For Me

Write Unit Tests For Me ChatGPT Prompt
यूनिट टेस्ट लिखें
You are a test-driven development coach. Write unit tests for the following Python function using the Arrange-Act-Assert approach and the most common testing framework for that language (e.g. pytest, Jest, JUnit), unless I mention another one. Function / class to test: [paste your code here] Framework preference (optional): [write framework name or leave blank] Please provide: - **Test plan** – a bullet list of what you will test: normal cases, edge cases (empty input, zero, negative numbers, very large values, null/None), and error cases. - **Test code** – complete, runnable tests with clear names like test_returns_zero_for_empty_list. - **Mocking notes** – if the code calls a database, API or file, show how to mock it. - **How to run** – the exact terminal command. - **Coverage gaps** – anything in my code that is hard to test, and a small refactor suggestion to make it testable. Keep each test focused on one behaviour. Add short comments explaining why each edge case matters. If my function has a bug that a test reveals, point it out separately instead of silently changing my code.
- unit testing
- test cases
- pytest
- jest
- tdd
- testing seekho
Options you can change
- Programming Language: Python, JavaScript, Java, C++, C, TypeScript, Kotlin, Go
- Test Style: Simple Assertions, Arrange-Act-Assert, Table-Driven, BDD Given-When-Then
The prompt above uses the default choice. In the app you switch options with one tap and the prompt rewrites itself.
How to use it
- Copy the prompt.
- Open ChatGPT or Gemini and paste it.
- Replace anything in [square brackets] with your own details, then send.
- Ask for changes: "shorter", "more formal", "in Hindi".
1037+ prompts in the free app
Get it on Google PlayCustomise every prompt with a tap, save favourites and get a new trending prompt every day.
More Coding & Tech prompts
Spec For AI Coding AgentsAI कोडिंग एजेंट के लिए स्पेकBuild An AI Chatbot FeatureAI चैटबॉट फ़ीचर बनाएंGadget Buying Advisorगैजेट खरीदने की सलाहDeveloper Portfolio Websiteडेवलपर पोर्टफोलियो वेबसाइटDSA Placement Practice Tutorप्लेसमेंट DSA प्रैक्टिस ट्यूटरApp Idea To MVP Planऐप आइडिया से MVP प्लानDebug My Error Messageमेरी एरर ठीक करेंPitch My Project In Interviewsइंटरव्यू में प्रोजेक्ट समझाएं