Programming task project descriptor

You can configure your programming task by creating a Devskiller project descriptor.

The descriptor is a JSON file named devskiller.json and should be placed in the project's root folder.

Here is an example of the contents of a task descriptor:

{
    "readOnlyFiles" : [ "pom.xml" ],
    "hiddenFiles" : [ "hidden_file.txt" ],
    "verification" : {
        "testClassNamePatterns" : [ ".*verify_pack.*" ],
        "pathPatterns" : [ "**src/test/**/verify_pack**" ],
        "overwrite" : {
            "verify_pack/phpunit.xml": "phpunit.xml"
        },
        "replaceContent" :
             [ {"filePath": "pom.xml", "regexPattern" : "\\z", "newContent" : "At the end"} ]  
    },
    "candidateTestsIncludedInScoring": true    
}

All fields of the task descriptor are optional, if there is no value entered for a field, an appropriate default value will be used. Check the sections dedicated to project types to find default values.

All paths are relative to the location of the task descriptor file.

 

Read-only files

{
    "readOnlyFiles" : [ "pom.xml" ]
}

An array of path patterns to match files that should be marked as read-only.

If you want to mark the folder as read-only, use the following syntax:

{
    "readOnlyFiles" : [ "folder_name/**" ]
}

The candidate will not be allowed to modify the contents of these files, but the contents of the files will be visible to the candidate.

 

Hidden files

{
    "hiddenFiles" : [ "hidden_file.txt" ]
}

An array of file names, that should be marked as hidden files. The candidate will not see these files in the web browser code editor during the test.

NOTE: This only works for in-browser mode and its purpose is to make the IDE window clearer and easier to navigate for the candidate. If using the ZIP or git mode, the candidate will be able to see and edit the files marked as hidden. In order to prevent editing these files, they should be marked as read-only.

 

Verification - test class name patterns

{
    "verification" : {
        "testClassNamePatterns" : [ ".*verify_pack.*" ]
    }
}

An array of regular expressions for test class names, which should be treated as verification tests.

 

Verification - full test name patterns

{
    "verification" : {
        "testFullNamePatterns" : [ .*VerificationTest.*verifyThat.*" ]
    }
}

An array of regular expressions for full test names that should be treated as verification tests. By full test name you should understand className.methodName pair.

 

Verification - path patterns

{
    "verification" : {
        "pathPatterns" : [ "**src/test/**/verify_pack**" ]
    }
}

An array of path patterns to match verification files. All files matched as verification files will be excluded from the code that is visible to the candidate. Verification files are added to the project during the assessment phase.

 

Verification - overwrites

{
    "verification" : {
        "overwrite" : {
            "verify_pack/phpunit.xml": "phpunit.xml"
        }
    }
}

This JSON section defines the files that should be overwritten during the assessment phase. Define source paths as keys, and target paths as values of an overwrite object.

Overwrites can be used to overwrite, for example, a build descriptor, which contains a list of executed tests. The candidate shouldn't see any details of verification tests, so you can prepare two versions of the same file: one for the candidate (to give them the ability to build a project with some basic tests) and one for verification purposes.

All files matched as source paths will be excluded from the candidate's project template and will be added during the verification phase.

 

Verification - replaceContent

{
    "verification" : {
        "replaceContent" :
             [ {"filePath": "pom.xml", "regexPattern" : "\\z", "newContent" : "At the end"} ]  
    }
}

This JSON section defines the file content that should be replaced during the assessment phase. Specify the path of the file in which content should be changed in filePath field, the regex of the content to be changed in pattern and the replacement content in the newContent field.

 

Candidate tests included in the scoring 

{
    "candidateTestsIncludedInScoring": true
}

If the value of this field is set to true, the tests visible for the candidate will be run during the assessment phase along with the verification tests, and their results will be included in the score. This value is false by default.

 

Cloud options for DevOps and Kubernetes tasks

{
     "cloud":
{
           “k8sVersion”: “1.20”,
           “instanceSize”: “xsmall”,
           “instanceDiskSize”: “8”,
           “osVersion”: “ubuntu”,
           “osRelease”: “20.04”,
     }
}

For Kubernetes tasks, the k8sVersion field specifies the Kubernetes versions and is mandatory. For all DevOps tasks, there are optional fields that can be used to customize the default settings:

  • instanceSize - specifies the instance size; one of the following values are supported:
    • xsmall - 0.5GiB memory, 1 vCPU (default)
    • micro - 1GiB memory, 1 vCPU
    • small - 2GiB memory, 1 vCPU
    • medium - 4GiB memory, 2 vCPUs
  • instanceDiskSize - specifies the disk size in GiB (8 by default)
  • osVersion - specifies the OS version - ubuntu or centos (ubuntu by default, ignored for Kubernetes)
  • osRelease - specifies the OS release - 16.04 or 20.04 for ubuntu, and 7 for centos (16.04 by default, ignored for Kubernetes)
Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request