Write Test Scripts

TestCafe Studio allows you to write tests using JavaScript and TypeScript.

Follow the steps below to write test script from scratch.

  1. Create a test script file in a test directory or subdirectory. Select the directory in the Explorer panel, invoke the context menu, and select New Test Script button New Test Script. In the New Test Script dialog, specify the file name and extension (.js or .ts) and click Create.

    New Test Script dialog

    TestCafe Studio creates the file with a test script template and opens it in the Code Editor.

    Test Script Template

  2. Edit the test script template: modify the fixture's name, the test's name, specify a tested page's URL, and add the test code to the test function. See the Test API topic in the open-source TestCafe documentation for information about the API used in tests.

    Write Test Script

Convert Recorded Tests to JavaScript

You can convert recorded tests to JavaScript. See Convert Fixtures to JavaScript for more information.