Record Tests

Tests consist of test actions that should be performed on a tested page.

Example test

You can create tests:

This topic provides the steps to record tests.

Select a Browser

You can record tests in local browsers. TestCafe detects browsers on the local computer and adds them to the Record Browser drop-down menu. Before recording a test, select the browser from the list.

Browser Menu

Open a Test Directory

See Test Directory to learn how to open a test directory.

Create Fixtures

Recorded tests should be organized into categories called fixtures. A fixture stores data used in the tests: a target page URL and authentication credentials.

You can view and modify a fixture in the Fixture Editor.

To create a new fixture, follow the steps below:

  1. In the Explorer panel, do one of the following:

    • Click Create a New Fixture
    • Right-click a test directory or subdirectory and select New Fixture from the context menu.

    This invokes the Fixture Properties dialog.

  2. Specify the fixture's properties and click Create.

    Creating a Fixture

TestCafe Studio creates a file with a test fixture and adds an empty test to the fixture.

Created fixture

Next, record test actions. To start recording, click the Record test actions button Record test actions button on the Test Editor's toolbar. See Start and Stop Recording for more information.

Note

TestCafe Studio automatically creates a new fixture if you start recording a test from the Welcome page.

Create Tests

Note

There are two cases when you can skip this step and go to recording:

  • You already have an empty test.
  • You start recording a test from the Welcome page. TestCafe Studio automatically creates a new test in this case and starts recording. See During Recording.

To create an empty test:

  1. Open the context menu for a desired fixture in the Explorer panel and select New test icon New Test.
  2. In the New Test dialog, specify the test name and click Create.

    Creating a Test

TestCafe Studio creates a test with the specified name and opens it in the Test Editor. Next, add actions from the Actions panel to the test or record actions. To start recording, click Record test actions button Record test actions on the Test Editor's toolbar.

Start and Stop Recording

Do any of the following to start recording a new test:

  • Select a fixture in the Explorer panel and click Start recording a test Record a New Test.
  • Click Start recording a test Record a new test on the Fixture Editor's toolbar.
  • Click Start recording a test Start recording a test on the Welcome page.

TestCafe Studio creates a new test, adds it to the fixture and starts recording test actions. See During Recording.

To record new actions to an existing test, click Start recording a test Record test actions on the Test Editor's toolbar. If the test already has test actions, TestCafe replays them and waits for you to record new actions.

To stop recording, close the browser or click Stop recording button on the Test Editor's toolbar.

During Recording

After you click the Start recording a test Record button, TestCafe Studio launches the specified browser and starts recording your activity on the tested page.

You can do the following during test recording:

  • Record on-page actions (clicks, drags, key presses, etc.) by interacting with the web page. These actions and their parameters are added to the test.

  • Add actions from the Actions panel to the test.

    You can use an element picker to select a target element on the tested page when you add an on-page action or assertion. To do this, click the Element picker button in the action parameters' area and click an element on the page.

    When you create an assertion, you can also choose a property from the auto-generated property list. See Assertion Parameters.

  • View and modify the recorded actions. See Modify Tests.

Modify Tests

You can view and modify recorded tests in the Test Editor during and after recording.

You can perform the following tasks:

Note

You cannot visually select target elements for actions if you add or modify the actions after recording - you should specify them manually.