Article 5 of 5 in a series on creating your own tests.
This is the fifth article in a series of five, to help you create your own tests using the TestGorilla platform. The full series includes:
- Developing an effective screening test
- Choosing a question type
- Writing situational judgment questions
- How to create your own test
- Creating a coding question or test (optional)
The option for adding your own tests is available to account owners, admins, and recruiters who are on our Scale and Business plans.
When creating your own test, we recommend outlining it before putting it into the TestGorilla platform. This will help ensure that everything is organized and laid out exactly as you want.
Approx. reading time 8 minutes
In this article
- What is a coding question
- Creating a coding question
- Common questions
- Next step
What is a coding question?
Coding tests and questions are used to assess a candidate’s ability to create or debug code in a specified language within a certain time limit. For most coding languages, we develop tests in the following categories:
- Algorithmic thinking (e.g. searching, sorting, recursion, iteration)
- Language-specific concepts (e.g. data structures, object-oriented programming)
The key difference between a coding test and a coding question is that a test contains a bank of coding questions, and our platform will cycle through them. A coding question is presented alone, as part of the Custom questions section.
Who can create a coding question?
Any user with the Owner, Admin, or Recruiter role is able to create a custom coding test or question. Due to the highly technical nature of coding tests, you are required to have an expert in your required coding language create your questions for you.
Note: TestGorilla cannot assist you with the content of custom tests. Any tests you create yourself must be an original creation.
Available coding languages
We currently have 15 coding languages available, which can be used in both tests and questions:
- Java: OpenJDK 12
- C: GCC 10
- C++: G++ 10
- C#: SDK 3.1.300
- Go: 1.16
- PHP: 7.4
- Python: 3.8
- Ruby: 3
- SQL: SQLite 3.31.1
- Typescript: 4.3.4
Note: Only one language can be used per test or question.
Creating a coding question
Coding questions can be used in two ways:
- As part of your question bank for a My company test
- As a custom question, added in Step 3: Add questions during the assessment creation process
The process of creating your coding question is the same, regardless of which method you are following. Each of the linked guides go into more detail about how to reach the required stage. This guide will take you through the process of using the question editor to create your coding question.
Select your language
The first screen presented to you after launching the question editor allows you to choose your coding language. There are 15 languages to choose from, choose one from the grid to move to the next screen.
Note: If you are creating a My company test, the language must remain the same for all coding questions within the test.
If you are using custom questions, you can choose a different language for each question.
The question editor is on the next screen. The text box on the left side of the page is where you will write your test description. This will provide the details your candidate needs to be able to complete the exercise. You can format the text by using the toolbar at the top of the text box. This will allow you to highlight key passages of text.
Writing the test description
We recommend breaking down your test description into five steps:
Give some context and the overall goal of the coding task. This brings the question to life and is necessary for the candidate to understand the intent of the coding task. Here's a good example of what this would look like:
Articulate in clear terms what the candidate needs to do. For this example, let's say the candidate needs to write a function. You'll want to
Working with our above scenario, here is an example:
Give an example of input and output that satisfies the requirements. This might look something like this:
Add relevant details. In our vault example, this would be:
Optional: Add any potential hints or other considerations. This is not necessary in most cases, but might be something you want to add.
Entering code-specific information
The right side of the page is for you to enter code-specific information. There are 4 tabs for you to complete:
Here you can set the type of variable the function returns, its name, and the input parameter(s). You can choose from the following parameter types:
- Array (entered as comma separated values such as 1,2,3,4,5)
Note: Objects are not supported as function parameter
The initial code is the starting point for candidates. It shows the function signature. You can add some code as a starting point if your task requires it. Please indicate where candidates are expected to insert their own code.
Note: This is not necessary if you're developing a debugging task
Test cases are combinations of input and output parameters that satisfy the requirements you've specified in the question. Under this tab you'll find two headers:
- Test cases to be used during the test. These are test cases the candidate has access to during the test. They help guide the candidate to complete the coding task successfully, since candidates can test their code against these test cases during the exercise.
If the candidate clicks run during the coding exercise, the code they have written is executed with the input parameters specified in each of these test cases.
If their code returns a result that matches the results you specified, the test case is passed, and the candidate will be told so. If their code fails, they will also be told so; this enables them to search for errors and make edits before final submission.
These test cases should be straightforward. We recommend making 3 or 4 of them.
- Test cases to be used for validation. These are test cases that will be used to produce the final test score. They are not used during the assessment, so candidates cannot check their code against these test cases.
These test cases should cover all requirements laid out in your scenario, including exceptions, corner cases, etc. We recommend creating 6-10 depending on the complexity of the question.
The Correctness score will be the percentage of passed validation test cases.
You can also add test cases to measure the efficiency of the code. These test cases produce the Performance score, showing the % of performance tests passed.
The performance is defined by the runtime required to execute the test case, in milliseconds. The candidate’s code passes the performance test case if the runtime of the code is fully executed within the time limit you have set.
A performance test case is relevant for coding tests where scalability is important. You can see how much time it took to run a performance test case when you run your verification code (see below):
The verification code is basically the model answer. You need to code it and run it to ensure all test cases you entered are passed. Only then can you save the question.
Once the candidate has completed the test, there will be a coding report that shows the candidate's code and the result of the validation test cases that determine the score. You can read more about the coding test report here.
SQL tests are a bit different, given the additional database component in the test. Here you can see the purpose of the different tabs when writing a SQL test:
- Database structure. Here, you choose whether you ask the candidate to write a query — using SELECT — or a database update — using INSERT, UPDATE, or DELETE.
This tab is also where you'll script the initial database by creating the table(s) and inserting the appropriate values. In most cases, you should copy your initial database structure as a code block into the test description. Otherwise, candidates have no idea how the database is structured and what’s in it.
- Initial code. Here you can include some first lines of code if your task require it.
- Test cases. As above, test cases are split between test cases that are available to the candidate — Test cases to be used during the test — and test cases used to determine the Correctness Score — Test cases to be used for validation.
The biggest difference with writing SQL questions is in the structure of test cases. When writing test cases, you'll be able to insert additional values into the database in the Test case setup. This setup is a script that will run immediately after the creation of the database structure, but before the candidate code. The verification code works in the same way as in other coding questions: this is the model answer and should be clean and efficient.
When writing a SQL test case, it's good to keep the following flows in mind.
In the event that you ask the candidate to create a query, you define the expected result of the query given the database structure and the test case setup, as per figure 1 below
Figure 1: Sequence of SQL scripts being executed when asking a candidate to write a query (using SELECT)
In the event that you ask the candidate to write a database update, you should also write a checking query. This query will be executed after the test taker code.
In the Result you specify what the checking query is supposed to return. See figure 2.
Figure 2: Sequence of SQL scripts being executed when asking a candidate to write a database update (using INSERT, UPDATE, or DELETE)
Note: Every test case recreates the database. Test cases are therefore isolated from each other.
Saving your question
The easiest part of the process! When you have completed entering all of the details, click the Save button in the top-right corner of the screen.
Our platform will run all of your code first to ensure that there are no errors. You will receive an error message if any are detected — you’ll need to go through everything again to correct your error.
If the save is successful, the question editor window will close and return you to your previous screen.
Why do I need to create multiple coding questions for my test?
This allows our platform to present a different question each time your test is used. If you have candidates who have taken your test before, they will have an advantage over the other test takers as they will know the content of the test ahead of time. Having multiple questions reduces the risk of this happening.
Should I use a coding test or a custom coding question?
This will depend on your own needs. If you frequently screen candidates for the same developer role, taking the time to make a full company test might be better, so that you don't have to do the process again anytime soon. However, if you only need one or two questions, and have the space within your plan's allotted custom questions, that could be easier.
Is there a limit to how many coding tests or questions I can use in my assessment?
Your assessment can include up to 5 tests and — depending on your plan — as many as 20 custom questions. In theory, you could have 5 coding tests and 20 custom coding questions in your assessment. Just bear in mind the overall length of your assessment; a candidate is unlikely to take your assessment if they have to spend 12 hours on it!
While not included in this series, we do have other articles that are helpful when making your own test that are worth taking a look at. They are: