---
title: "Test cases - CoderPad Interview Docs"
description: "Learn how to create test cases for Interview's take-home tests to automatically check the correctness of your candidates' code."
canonical: "https://coderpad.io/resources/docs/interview/question-bank/test-cases/"
last_modified: "2023-02-02 12:15:07"
---
1. [Docs home](https://coderpad.io/resources/docs/) /
2. [Interview](https://coderpad.io/resources/docs/interview/) /
3. [Interview question bank](https://coderpad.io/resources/docs/interview/question-bank/) /
4. [Test cases](https://coderpad.io/resources/docs/interview/question-bank/test-cases/)
[Documentation menu](#docs-navigation)

# Test cases

Last updated on February 2, 2023

With take-home projects you have the ability to run test cases. Test cases allow you to test a candidate’s code against certain requirements. You will also be able to view the test cases’ pass/fail results once the candidate has finished their take-home project.

You set them up during Step 2 – Add Take-Home Test Cases of [question creation/editing](https://coderpad.io/resources/docs/interview/question-bank/creating-a-question/).

[![The "add take-home test cases" page. Here you have the option of adding input parameters and desired outputs for test cases.](https://coderpad.io/wp-content/uploads/2021/10/take-homes-1024x1007.png)](https://coderpad.io/wp-content/uploads/2021/10/take-homes.png)

## 1. Set up the function signature

In order to run tests on the solution function, we must know how many parameters are enabled, what types they are, and what the expected return type of the function is.

Parameters should be named and assigned a type using the dropdowns.

You can add multiple parameters to a function by selecting the Add Parameter button, and repeating the steps to name the parameter and assign the type.

[![The "add take home test cases page" showing the input parameters and an arrow pointing to the "add parameter" button.](https://coderpad.io/wp-content/uploads/2022/09/image-64-1024x240.png)](https://coderpad.io/wp-content/uploads/2022/09/image-64.png)

If you want to remove a parameter, click the trashcan icon on the left-hand side of the parameter.

[![The input parameters section, there are trashcans to the left of each parameter to remove them.](https://coderpad.io/wp-content/uploads/2021/10/test_case_item-1024x497.png)](https://coderpad.io/wp-content/uploads/2021/10/test_case_item.png)

Finally, you can set the type of the function’s return value

Supported types include:

- Integer
- String
- Integer Array
- String Array

These types are consistent across all supported take-home project languages. These same types are enabled for both parameter types and return types.

## 2. Add the test case solutions

Next you’ll add the inputs and expected outputs you expect to see from a candidate’s solution.

There one test case solution will be automatically added for you to fill out, but you can easily add more by pressing the Add Test Case button.

[![Test case solutions section with input parameter and required output for that parameter.](https://coderpad.io/wp-content/uploads/2022/09/image-65-1024x488.png)](https://coderpad.io/wp-content/uploads/2022/09/image-65.png)

You’re able to remove test cases by selecting the trashcan-shaped delete button to the left-hand side of the test case you’d like to remove.

Each test case also includes a toggle of whether to make it visible to the candidate or not. Non-visible test cases are not shown to candidates but are still tested against the candidate code and reported to the interviewer in playback mode.

## Candidate View

When a candidate accesses a pad with take-home test cases, they’ll be able to see the visible tests within the Test Cases tab:

[![A pad with candidate code on the left and the test cases tab open on the right.](https://coderpad.io/wp-content/uploads/2022/09/image-61-1024x232.png)](https://coderpad.io/wp-content/uploads/2022/09/image-61.png)

They can run specific test-cases by checking the desired checkboxes and pressing Run selected test cases. Once ran, the Pass column on the right will update to indicate whether the test was successful or not.

[![The results of the test cases. There is an arguments, expected result, and pass column value for each row/test case.](https://coderpad.io/wp-content/uploads/2022/09/image-62.png)](https://coderpad.io/wp-content/uploads/2022/09/image-62.png)

You’re also able to see test output from the Program Output tab, along with the expected and actual results for each failed test.

[![The output window is shown with both the output of the code as well as the results of the test cases.](https://coderpad.io/wp-content/uploads/2022/09/image-63-1024x500.png)](https://coderpad.io/wp-content/uploads/2022/09/image-63.png) Close Docs Index
- [Screen](https://coderpad.io/resources/docs/screen/) Toggle children pages
  - [Quick start guides](https://coderpad.io/resources/docs/screen/recruiters-quickstart/) Toggle children pages
    - [Onboarding Checklist](https://coderpad.io/resources/docs/screen/recruiters-quickstart/screen-onboarding-checklist/)
    - [The CoderPad Screen Score Guide](https://coderpad.io/resources/docs/the-coderpad-screen-score-guide/)
    - [Video Guides](https://coderpad.io/resources/docs/screen/recruiters-quickstart/video-guides/)
  - [Tests](https://coderpad.io/resources/docs/screen/tests/) Toggle children pages
    - [Creating a test](https://coderpad.io/resources/docs/screen/tests/creating-a-test/)
    - [Customizing test content](https://coderpad.io/resources/docs/screen/tests/customizing-test-content/)
    - [Editing test settings](https://coderpad.io/resources/docs/screen/tests/editing-test-settings/)
    - [AI Tools for Screen](https://coderpad.io/resources/docs/screen/tests/ai-tools-for-screen/)
    - [Test management](https://coderpad.io/resources/docs/screen/tests/test-management/)
    - [Test retake requests](https://coderpad.io/resources/docs/screen/tests/test-retake-requests/)
    - [Cheating prevention and detection in Screen](https://coderpad.io/resources/docs/screen/tests/cheating-prevention-detection/) Toggle children pages
      - [Webcam proctoring](https://coderpad.io/resources/docs/screen/tests/cheating-prevention-detection/webcam-proctoring/)
    - [Test Insights](https://coderpad.io/resources/docs/test-insights/)
  - [Projects NEW](https://coderpad.io/resources/docs/screen/tests/projects/)
  - [Candidate management](https://coderpad.io/resources/docs/screen/candidate-management/) Toggle children pages
    - [Anonymizing candidates](https://coderpad.io/resources/docs/screen/candidate-management/anonymizing-candidates/)
    - [Import candidates from CSV file](https://coderpad.io/resources/docs/screen/candidate-management/import-candidates-from-csv-file/)
  - [Candidate reports](https://coderpad.io/resources/docs/screen/candidate-reports/) Toggle children pages
    - [Candidates dashboard](https://coderpad.io/resources/docs/screen/candidate-reports/candidate-dashboard/)
    - [Code playback](https://coderpad.io/resources/docs/screen/candidate-reports/code-playback/)
    - [Fixing an incorrectly marked question](https://coderpad.io/resources/docs/screen/candidate-reports/fixing-an-incorrectly-marked-question/)
    - [Error messages in candidate reports](https://coderpad.io/resources/docs/screen/candidate-reports/error-messages-in-candidate-reports/)
  - [Customizing questions](https://coderpad.io/resources/docs/screen/customizing-questions/) Toggle children pages
    - [Creating custom questions](https://coderpad.io/resources/docs/screen/customizing-questions/creating-custom-questions/) Toggle children pages
      - [Custom Project questions](https://coderpad.io/resources/docs/screen/customizing-questions/creating-custom-questions/custom-project-questions/)
    - [Importing questions](https://coderpad.io/resources/docs/screen/customizing-questions/importing-questions/)
    - [Customized domains and skills](https://coderpad.io/resources/docs/screen/customizing-questions/customized-domains-and-skills/)
    - [Sharing your custom questions](https://coderpad.io/resources/docs/screen/customizing-questions/sharing-your-custom-questions/)
  - [Integrations](https://coderpad.io/resources/docs/screen/integrations/) Toggle children pages
    - [Ashby for Screen](https://coderpad.io/resources/docs/screen/integrations/ashby-for-screen/)
    - [Greenhouse for Screen](https://coderpad.io/resources/docs/screen/integrations/greenhouse/)
    - [iCIMS](https://coderpad.io/resources/docs/screen/integrations/icims/)
    - [Jobvite](https://coderpad.io/resources/docs/screen/integrations/jobvite/)
    - [Lever](https://coderpad.io/resources/docs/screen/integrations/lever/)
    - [SmartRecruiters](https://coderpad.io/resources/docs/screen/integrations/smartrecruiters/)
    - [Taleez](https://coderpad.io/resources/docs/screen/integrations/taleez/)
    - [Taleo](https://coderpad.io/resources/docs/screen/integrations/taleo/)
    - [Teamtailor](https://coderpad.io/resources/docs/screen/integrations/teamtailor/)
    - [Workable](https://coderpad.io/resources/docs/screen/integrations/workable/)
    - [Workday](https://coderpad.io/resources/docs/screen/integrations/workday/)
  - [Account management](https://coderpad.io/resources/docs/screen/account-management/) Toggle children pages
    - [Editing your profile](https://coderpad.io/resources/docs/screen/account-management/editing-your-profile/)
    - [Managing users & teams](https://coderpad.io/resources/docs/screen/account-management/managing-users/)
    - [Billing](https://coderpad.io/resources/docs/interview/account-mgmt/billing-history/)
    - [Configure data protection](https://coderpad.io/resources/docs/screen/account-management/configure-data-protection/)
    - [Insights](https://coderpad.io/resources/docs/interview/account-mgmt/insights/)
    - [SSO](https://coderpad.io/resources/docs/screen/account-management/sso/) Toggle children pages
      - [Okta SSO legacy process](https://coderpad.io/resources/docs/screen/account-management/sso/okta-sso-legacy-process/)
    - [Cancel your subscription](https://coderpad.io/resources/docs/interview/account-mgmt/unsubscribing/)
  - [More](https://coderpad.io/resources/docs/screen/more-screen-resources/) Toggle children pages
    - [FAQ](https://coderpad.io/faqs/#screen-faq)
    - [Supported languages, frameworks, & technologies](https://coderpad.io/resources/docs/screen/more-screen-resources/supported-languages-frameworks-technologies/) Toggle children pages
      - [Available domains](https://coderpad.io/resources/docs/screen/more-screen-resources/supported-languages-frameworks-technologies/available-domains/)
      - [What compiler does my Screen project run on?](https://coderpad.io/resources/docs/screen/more-screen-resources/supported-languages-frameworks-technologies/what-compiler-does-my-screen-project-run-on/)
      - [What compiler does my Screen test run on?](https://coderpad.io/resources/docs/screen/more-screen-resources/supported-languages-frameworks-technologies/what-compiler-does-my-test-run-on/)
      - [Supported browser versions](https://coderpad.io/resources/docs/screen/more-screen-resources/supported-languages-frameworks-technologies/browser-versions/)
    - [API key access](https://coderpad.io/resources/docs/screen/more-screen-resources/api-key-access/)
    - [Accessibility](https://coderpad.io/resources/docs/accessibility/)
    - [API documentation](https://coderpad.io/resources/docs/screen/more-screen-resources/api-documentation/)
    - [Troubleshooting Screen](https://coderpad.io/resources/docs/screen/more-screen-resources/troubleshoot/)
    - [Static code analysis](https://coderpad.io/resources/docs/screen/more-screen-resources/static-code-analysis/)
    - [Code editor](https://coderpad.io/resources/docs/screen/more-screen-resources/monaco-code-editor/)
    - [Report a question leak](https://coderpad.io/resources/docs/screen/more-screen-resources/report-a-question-leak/)
- [Interview](https://coderpad.io/resources/docs/interview/) Toggle children pages
  - [Quick start guides](https://coderpad.io/resources/docs/interview/quick-start-guides/) Toggle children pages
    - [Onboarding Checklist](https://coderpad.io/resources/docs/interview/quick-start-guides/interview-onboarding-checklist/)
    - [Interviewers](https://coderpad.io/resources/docs/interview/quick-start-guides/interviewers/) Toggle children pages
      - [Live Interview quick start](https://coderpad.io/resources/docs/interview/quick-start-guides/interviewers/live-interview-pads/)
      - [Take-home project quick start](https://coderpad.io/resources/docs/interview/quick-start-guides/interviewers/take-home-projects/)
      - [Interview best practices](https://coderpad.io/resources/docs/interview/quick-start-guides/interviewers/interview-best-practices/)
    - [Recruiters](https://coderpad.io/resources/docs/interview/quick-start-guides/recruiters/)
    - [Account administrators](https://coderpad.io/resources/docs/interview/quick-start-guides/account-admins/)
    - [Video Guides](https://coderpad.io/resources/docs/interview/quick-start-guides/coderpad-interview-quickstart-video-guides/)
    - [Engineer’s guide to multi-file frameworks](https://coderpad.io/resources/docs/interview/quick-start-guides/multi-file-frameworks-for-engineers/)
    - [Talent acquisition’s guide to multi-file frameworks](https://coderpad.io/resources/docs/interview/quick-start-guides/multi-file-frameworks-for-talent-acquisition-teams/)
  - [Pads](https://coderpad.io/resources/docs/interview/pads/) Toggle children pages
    - [Creating a pad](https://coderpad.io/resources/docs/interview/pads/creating-a-pad/)
    - [Using pad features](https://coderpad.io/resources/docs/interview/pads/using-pad-features/)
    - [Jupyter Notebooks](https://coderpad.io/resources/docs/interview/pads/jupyter-notebooks/)
    - [API client](https://coderpad.io/resources/docs/interview/pads/api-client/)
    - [AI Tools for Interview](https://coderpad.io/resources/docs/interview/pads/interview-ai-assist/)
    - [Code editor](https://coderpad.io/resources/docs/interview/pads/code-editor/)
    - [Video & audio chat](https://coderpad.io/resources/docs/interview/pads/video-and-audio-call/) Toggle children pages
      - [AI Notetaker](https://coderpad.io/resources/docs/interview/pads/live-interview-transcription/)
      - [Interview Highlights NEW](https://coderpad.io/resources/docs/interview-highlights/)
      - [Interview Outlines NEW](https://coderpad.io/resources/docs/interview/pads/video-and-audio-call/interview-outlines/)
    - [Private Interviewer Notes](https://coderpad.io/resources/docs/interview/pads/private-interviewer-notes/)
    - [Settings](https://coderpad.io/resources/docs/interview/pads/settings/)
    - [Keyboard shortcuts](https://coderpad.io/resources/docs/interview/pads/keyboard-shortcuts/)
    - [Playback & Pad Summary](https://coderpad.io/resources/docs/interview/pads/playback-mode/)
    - [Duplicate pads](https://coderpad.io/resources/docs/interview/pads/duplicate-pads/)
    - [Pad bulk actions](https://coderpad.io/resources/docs/interview/pads/pad-bulk-actions/)
  - [Drawing mode](https://coderpad.io/resources/docs/interview/drawing-mode/)
  - [Interview question bank](https://coderpad.io/resources/docs/interview/question-bank/) Toggle children pages
    - [Creating and editing questions](https://coderpad.io/resources/docs/interview/question-bank/creating-and-editing-a-question/)
    - [Example questions](https://coderpad.io/resources/docs/interview/question-bank/example-questions/)
    - [Test cases](https://coderpad.io/resources/docs/interview/question-bank/test-cases/)
  - [Focus Time](https://coderpad.io/resources/docs/interview/focus-time/)
  - [Databases](https://coderpad.io/resources/docs/interview/databases/)
  - [Custom files](https://coderpad.io/resources/docs/interview/custom-files/)
  - [Integrations](https://coderpad.io/resources/docs/interview/integrations/) Toggle children pages
    - [Ashby for Interview](https://coderpad.io/resources/docs/interview/integrations/ashby/)
    - [GoodTime](https://coderpad.io/resources/docs/interview/integrations/goodtime/)
    - [Google Chrome Calendar extension](https://coderpad.io/resources/docs/interview/integrations/google-chrome-calendar-extension/)
    - [Greenhouse for Interview](https://coderpad.io/resources/docs/interview/integrations/greenhouse/) Toggle children pages
      - [Greenhouse live interview integration](https://coderpad.io/resources/docs/interview/integrations/greenhouse/live-interview-integration/)
      - [Greenhouse take-home projects integration](https://coderpad.io/resources/docs/interview/integrations/greenhouse/take-home-integration/)
    - [iCIMS](https://coderpad.io/resources/docs/interview/integrations/icims/)
    - [Lever](https://coderpad.io/resources/docs/interview/integrations/lever/)
    - [Gem](https://support.gem.com/hc/en-us/articles/26933157317399-How-do-I-connect-my-CoderPad-account)
    - [SmartRecruiters](https://coderpad.io/resources/docs/interview/integrations/smartrecruiters/)
    - [ModernLoop](https://modernloop.notion.site/coderpad)
    - [Workday](https://coderpad.io/resources/docs/screen/integrations/workday/)
  - [Account management](https://coderpad.io/resources/docs/interview/account-mgmt/) Toggle children pages
    - [Team management](https://coderpad.io/resources/docs/interview/account-mgmt/team-management/)
    - [Managing users](https://coderpad.io/resources/docs/interview/account-mgmt/managing-users/)
    - [SSO](https://coderpad.io/resources/docs/screen/account-management/sso/)
    - [Insights](https://coderpad.io/resources/docs/interview/account-mgmt/insights/)
    - [Billing](https://coderpad.io/resources/docs/interview/account-mgmt/billing-history/)
    - [Canceling your subscription](https://coderpad.io/resources/docs/interview/account-mgmt/unsubscribing/)
  - [More](https://coderpad.io/resources/docs/interview/more-interview-resources/) Toggle children pages
    - [Cheating prevention and detection in Interview](https://coderpad.io/resources/docs/cheating-prevention-in-interview/)
    - [FAQ](https://coderpad.io/faqs/#live-faq)
    - [Accessibility](https://coderpad.io/resources/docs/accessibility/)
    - [Supported technologies & languages](https://coderpad.io/resources/docs/interview/more-interview-resources/supported-technologies-languages/) Toggle children pages
      - [Languages & frameworks](https://coderpad.io/languages/)
      - [Unit testing](https://coderpad.io/resources/docs/unit-testing/) Toggle children pages
        - [Using Jest with React](https://coderpad.io/resources/docs/unit-testing/using-jest-with-react/)
      - [Supported browser versions](https://coderpad.io/resources/docs/screen/more-screen-resources/supported-languages-frameworks-technologies/browser-versions/)
    - [API key access](https://coderpad.io/resources/docs/interview/more-interview-resources/api-key/)
    - [API documentation](https://coderpad.io/resources/docs/interview/more-interview-resources/api-documentation/)
    - [Troubleshooting](https://coderpad.io/resources/docs/interview/more-interview-resources/troubleshooting/)
    - [Server statuses](https://status.coderpad.io/?_gl=1*ta4d92*_ga*MTkzMTE2ODYyMC4xNjU4MjQ5Mzcw*_ga_XBQ5N5CE2N*MTY2NzQxOTY5OS4yNjIuMS4xNjY3NDIxNDQ0LjAuMC4w&_ga=2.62808234.704669655.1667307151-1931168620.1658249370)
    - [Data management and privacy policy](https://coderpad.io/privacy/)
- [AI Fluency](https://coderpad.io/resources/docs/ai-fluency/)
- [For candidates](https://coderpad.io/resources/docs/for-candidates/) Toggle children pages
  - [Screen preparation guide](https://coderpad.io/resources/docs/for-candidates/screen-preparation-guide/) Toggle children pages
    - [Webcam and microphone access](https://coderpad.io/resources/docs/for-candidates/screen-preparation-guide/webcam-access/)
    - [Projects exercises](https://coderpad.io/resources/docs/for-candidates/screen-preparation-guide/projects-exercises/)
  - [Interview preparation guide](https://coderpad.io/resources/docs/for-candidates/interview-preparation-guide/) Toggle children pages
    - [Try the sandbox](https://coderpad.io/resources/docs/for-candidates/interview-preparation-guide/sandbox/)
  - [FAQ](https://coderpad.io/faqs/#faq-do-candidates-have-to-register-an-account-or-pay-to-use-interview)
- [What’s new?](https://coderpad.io/resources/docs/changelog/)
