Fill in your details optional The prompt below updates as you type. What you type stays in this browser and is never sent to us.
You are an expert in this kind of work, and you know the Manufacturing sector from the inside.
## Your task
Write unit tests for the function below, used in a manufacturing plant running shift-based production lines. Use [TEST FRAMEWORK]. Cover the normal path, edge cases (empty input, nulls, boundaries, large values) and expected failures. Name each test after the behaviour it checks, and add one line explaining any case that is not obvious.
## About my situation
- Who this is for: plant managers, line operators and procurement teams
- What we must respect: safety rules, ISO 9001 quality standards and fixed production schedules
- How we measure success: OEE and defect rate
## What matters in Manufacturing
- Rules and standards that usually apply: ISO 9001 quality management; worker-safety law (OSHA in the US, the Factories Act and labour codes in India) and ISO 45001; lockout/tagout and machine guarding; ISO 14001 and pollution-control consents; product marks such as CE or BIS certification.
- Common risks to plan for: machine breakdowns; supplier delays and raw-material price swings; quality escapes reaching customers; worker injuries; errors at shift handover.
- Tools commonly used: ERP such as SAP or Tally; MES; CMMS for maintenance; SPC software; Excel.
- Words people in this field use: OEE; takt time; cycle time; WIP; BOM; changeover; kaizen; 5S; SPC; CAPA.
- Rules differ by country. If I have not said where I work, ask me, and do not present one country's law as if it applied everywhere.
## What I will give you
Function:
[PASTE FUNCTION]
## How to work through it
1. Explain what the function should do, including its inputs and outputs.
2. List the normal cases, edge cases and failure cases before writing any test.
3. Write the tests, one behaviour per test, named after that behaviour.
4. Add mocks or fixtures only where the function touches the outside world.
5. Point out any bug the tests reveal.
## What to deliver
- A list of test cases grouped by normal, edge and failure
- The complete test file, ready to run
- How to run the tests
- Any bugs found
## Rules
- Make every point specific to my situation and my industry; replace generic advice with detail that fits.
- Use plain language, short sentences, and tables where they make the answer easier to scan.
- Use only the facts I give you. Do not invent figures, laws, sources or quotes. Mark anything you had to assume with "Assumption:".
- If something important is missing, ask me up to 3 short questions before you start.
## Before you answer
Check your draft against this list and fix anything that fails:
- The code works as written: no invented libraries, functions or APIs, and versions are named where they matter.
- It is written for a manufacturing plant running shift-based production lines; nothing in it would read the same for any other business.
- Nothing in it breaks safety rules, ISO 9001 quality standards and fixed production schedules.
- Every item under "What to deliver" is included.
How to use this prompt
- Copy the prompt. Press Copy prompt and the full text goes to your clipboard.
- Fill the brackets. Use the form above, or replace [TEST FRAMEWORK], [PASTE FUNCTION] with your own details.
- Paste and send. Paste it into ChatGPT, Claude, Microsoft Copilot and DeepSeek and send. Ask follow-up questions to refine the answer.
Why this prompt works
The “Unit tests for a function” prompt tells the assistant exactly what to hand back: a list of test cases grouped by normal, edge and failure; the complete test file, ready to run; how to run the tests; and any bugs found. It makes the assistant work through 5 steps in order, starting with "explain what the function should do, including its inputs and outputs", instead of jumping straight to an answer. Before replying, the assistant checks its draft against 4 tests and fixes anything that fails.
This version is written for a manufacturing plant running shift-based production lines, so the assistant keeps safety rules, ISO 9001 quality standards and fixed production schedules in mind and judges the result by OEE and defect rate. If an important detail is missing, it asks you up to 3 short questions before it starts.
How to get the best answer
- Fill every bracket with real detail: [TEST FRAMEWORK], [PASTE FUNCTION] should hold real names, numbers and dates, not placeholders.
- Paste real material: where the prompt asks for notes, data or text, paste the actual content rather than a summary.
- Refine in the same chat: ask "make it shorter", "turn it into a table" or "add more detail on step 2".
- Check the result: review it against what you know about OEE and defect rate before you share it.
Other industries
Same prompt for other industries
The same unit tests for a function prompt, rewritten for each industry.
FAQ
Frequently asked questions
Which AI assistant works best with the “Unit tests for a function” prompt?
The “Unit tests for a function” prompt works in any chat assistant and suits ChatGPT, Claude, Microsoft Copilot and DeepSeek best. Paste it in, send it, and ask follow-up questions in the same chat to refine the answer.
What do I fill in before sending the “Unit tests for a function” prompt?
Replace the 2 highlighted brackets – [TEST FRAMEWORK], [PASTE FUNCTION] – with your own details. The more specific you are, the better the answer.
Is the “Unit tests for a function” prompt only for Manufacturing?
No. This version is written for a manufacturing plant running shift-based production lines, and the same prompt is also written for 15 other industries, listed on this page.
Is the “Unit tests for a function” prompt free to use?
Yes. First AI Prompt prompts are free to copy and use in personal and business work, with no sign-up, no account and no daily limit.
Can I trust the answer the “Unit tests for a function” prompt gives?
Treat it as a strong first draft: the prompt tells the assistant not to invent facts and to mark its assumptions, but check figures yourself, especially anything with legal, financial or safety consequences.
Keep exploring