- 2 minutes to read
A test script file can contain several tests that are organized by fixture. The Explorer panel displays these tests as the file's children. Fixture names are shown above the test list.
You can also convert recorded tests to test script files.
TestCafe Studio also allows you to use tests created in earlier TestCafe versions (
.test.js files). You can add these files to a test directory and view/modify/run the tests in TestCafe Studio.
Write a Test Script
Follow the steps below to write test script from scratch.
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. In the New Test Script dialog, specify the file name and extension (
.ts), and click Create.
TestCafe Studio creates the file with a test script template and opens it in the Code Editor.
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
testfunction. See the Test API topic in the open-source TestCafe documentation for information about the API used in tests.
To convert a test or fixture, do any of the following: