Overview
This article explains the different evaluation methods for Front-end, Back-End, and Full-Stack Development Questions. The information is handy for evaluating coding Questions based on React, Node.js, Angular, Ruby on Rails, etc.
Scoring a Code Development Question
There are two methods to score a code development question,
J-unit Test Case Based Scoring
This is the default method of scoring. In this method, an equal score is assigned to each of the test cases. If the candidate's code satisfies each test case, the candidate receives the full score. However, if the code satisfies certain test cases but fails some test cases, then the score obtained is proportional to the number of test cases that the code fulfills.
For instance: There are 5 test cases, and the total score assigned to this particular problem is 50. If the candidate's code satisfies 3 test cases but fails the other 2 test cases, then the candidate gets 30 as the final score.
Example:
<?xml version="1.0"?> <testsuite name="Node.js (linux; U; rv:v6.9.1) AppleWebKit/537.36 (KHTML, like Gecko)" package="unit" timestamp="2017-04-12T21:08:42" id="0" hostname="2c29b2a64693" tests="8" errors="0" failures="0" time="0.29"> <properties> <property name="browser.fullName" value="Node.js (linux; U; rv:v6.9.1) AppleWebKit/537.36 (KHTML, like Gecko)"/> </properties> <testcase name="CountryList should exist" time="0" classname="unit.CountryList"/> <testcase name="Check Rendered List check number of rows that are rendered" time="0.017" classname="unit.Check Rendered List"/> <testcase name="Main should exist" time="0.001" classname="unit.Main"/> <testcase name="Check Functions check if the filter works" time="0.093" classname="unit.Check Functions"/> <testcase name="Check Functions check empty search" time="0.061" classname="unit.Check Functions"/> <testcase name="Search should exist" time="0.001" classname="unit.Search"/> <testcase name="Check Search check if search bar works (case-sensitive)" time="0.071" classname="unit.Check Search"/> <testcase name="Check Search check if search bar works (case-insensitive)" time="0.046" classname="unit.Check Search"/> <system-err/> </testsuite>
Xunit Test Case Based Scoring
xUnit.net is a unit testing tool for the .NET Framework and is used for testing .NET languages. Xunit-based scoring can be used when setting up a .NET 2.0 project. Scoring for this format works similarly to Junit.
Example:
<?xml version="1.0" encoding="utf-8"?> <assemblies timestamp="01/25/2018 18:32:09"> <assembly name="/home/ubuntu/fullstack/project/tests/bin/Debug/netcoreapp2.0/tests.dll" run-date="2018-01-25" run-time="18:32:09" total="4" passed="2" failed="2" skipped="0" time="0.011" errors="0"> <errors /> <collection total="2" passed="1" failed="1" skipped="0" name="Test collection for Tests.UnitTest1" time="0.011"> <test name="Tests.UnitTest1.Test1" type="Tests.UnitTest1" method="Test1" time="0.0110000" result="Pass"> <traits /> </test> <test name="Tests.UnitTest1.Test2" type="Tests.UnitTest1" method="Test2" time="0.0110000" result="Fail"> <traits /> <failure message="failed">Failed</failure> </test> </collection> <collection total="2" passed="1" failed="1" skipped="0" name="Test collection for Tests.UnitTest2" time="0.011"> <test name="Tests.UnitTest2.Test1" type="Tests.UnitTest2" method="Test1" time="0.0110000" result="Pass"> <traits /> </test> <test name="Tests.UnitTest2.Test2" type="Tests.UnitTest2" method="Test2" time="0.0110000" result="Fail"> <traits /> <failure message="failed">Failed</failure> </test> </collection> </assembly> </assemblies>
TAP Scoring
Test Anything Protocol format, abbreviated as TAP, is a commonly used unit test output format. The protocol definition can be seen at:
https://testanything.org/tap-version-13-specification.html
We support a basic version of this output.
Example:
TAP version 13 1..6 # # Create a new Board and Tile, then place # the Tile onto the board. # ok 1 - The object isa Board ok 2 - Board size is zero not ok 3 - The object is a Tile ok 4 - Get possible places to put the Tile not ok 5 - Placing the tile produces error ok 6 - Board size is 1
Custom Scoring
HackerRank for Work gives question setters the flexibility to assign custom scoring for questions. As a question setter, you can specify the rules for scoring a particular question in a script. This script is an executable program or a shell command that specifies scoring rules and can be run in the Ubuntu environment. After you write the script, you must upload the script file to the test project folder. The format for custom scoring must follow the following format:
FS_SCORE: XY% where XY is a number from 1 through 100.
If you have uploaded a file for custom scoring, you must also specify the path for the scoring file while creating the test.
Example:
The candidate seems to have passed following: * create file * delete file Candidate has failed: * Modify file. FS_SCORE:60%