Software Developer how-to
How to Write a Unit Test
Tests protect code from future breakage.
Quick answer
Tests protect code from future breakage. In short: pick; set; call, then complete the remaining steps below.
Step by step
Pick one function or behavior.
Set up the input data.
Call the function.
Assert the expected output.
Test edge cases such as empty or invalid input.
Run tests automatically in CI.
Safety reminders for software developers
- Protect credentials and never commit secrets to code
- Follow secure coding practices
- Use ergonomic setups and take screen breaks
- Test changes before deploying to production
Key terms
Source code · Git · Pull request · API · Front end · Back end: see the full software developer glossary.
