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

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

Here is an example 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 task descriptor are optional, if there is no value for some field, an appropriate default value will be used. Check sections dedicated to project types to find default values.

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

Read-only files

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

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

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

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

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

Hidden files

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

An array with file names, which should be marked as hidden files. 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 view clearer and easier to navigate for the candidate. If using the ZIP or git mode, the candidate will 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 classes 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, which 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 code visible by candidate. Verification files are added to project during 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. Candidate shouldn't see any details of verification tests, so you can prepare two versions of the same file: one for candidate (to give him ability to build 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 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 taken included in the score. This value is false by default.

Did this answer your question?