HackerRank Tests based on Front-end, Back-end, or Full-Stack Developer roles provide developers an easy to use and in-built IDE to solve project type problems. HackerRank's IDE supports both offline and online working modes. You can clone a given project and work on it locally. After you've completed and tested the solution locally, commit the changes to the master branch and later push the changes online. Alternatively, you can choose to directly use the online IDE to work on the project.
Once you are logged in to the test, you can keep track of the time left for the test completion by viewing the displayed time on the top menu bar.
This article describes how you can use HackerRank's IDE to solve project type problems in HackerRank Tests.
- Login to your Test.
- While the Test server is being set up, click Open Tutorial to familiarize yourself with HackerRank's IDE before attempting the Questions in the Test.
- Wait for the ready state, and click Go to Test as shown below.
- Click Solve Question to answer a particular Question. The Question types in the Test will be based on the role you've applied for.
- After reading the question, scroll down to the IDE.
Cloning a project to your local IDE
- HackerRank's IDE enables you to clone the given project locally and work on the solution using your local IDE. After you've completed the solution, you can commit the changes to the project's master branch, push the changes to the online IDE, run the test cases and then submit the solution. During the Test, Developers can toggle between the IDE's online and offline modes to synchronize their local and online versions of the project.
To work on the project locally:
- Click Start with Local IDE.
Note: You are provided with some important instructions for working on the project locally and pushing the changes online. We recommend that you follow these instructions carefully to ensure that all the changes in your project are pushed online before your Test times out.
- Under "Clone git repository", copy the project's git link to clone the project locally.
- Note the Run, Install and Test commands required to execute the project locally.
- After you've completed and tested the solution locally, commit the changes to the master branch.
- Using the command git push origin master, push the project changes online to the Test.
- In the Test IDE, switch to the Online IDE mode.
- Ensure that your changes are reflected in the project files.
- Click Run Tests to execute all the test cases and verify the unit.xml file to know the test case execution status.
- Click Submit answer & continue to submit your answer in the Test.
Working on the Online Test IDE
- Click Use Online IDE.
- Type the code in the IDE to answer the question.
- Be mindful of the following while answering:
- Click Run and then click Install to install the build dependencies.
- Click Run or you can click the green arrow icon on the menu bar of the IDE to run the code.
- Click the Preview link to view the application website.
- Always save your code before you view the app. You are asked to enable the popups and then the app is launched in another tab. You can see the changes you have made to the code in real-time with this feature.
- Click Run and then click Test to run the unit tests.
- Depending on how the question is framed, the unit test case output might be displayed on the terminal, or in the J-unit output XML file. The terminal displays the number of test cases that pass or fail with your code.
- Click Run and then click Terminal to open the terminal.
- Do not modify ids or classes for the existing UI elements because they are required for the unit tests.
- If the total test time elapses, you will be automatically logged out of the test. In this case, we use your latest auto-saved code on our IDE to evaluate your test.
- Click Submit Code and continue at the right bottom corner of your screen to submit the question if you are satisfied with your answer.
Note: You can revisit your submitted answers and modify the submissions any number of times before the Test ends.