Scheduled performance tests

Updated at:

When you need to regularly run performance test tasks to monitor core services or validate system capabilities after software iterations, you can use the scheduled performance test feature. This feature allows you to specify the execution date, time, recurrence schedule, and notification methods for a task. This topic describes how to set up, modify, and delete scheduled performance tests.

Prerequisites

A performance test scenario must be created and successfully debugged. Debugging the scenario ensures that the PTS performance test task can run as scheduled. For more information, see Create a PTS performance test and Debug a scenario.

Limitations

  • The availability of the scheduled performance test feature and the number of scheduled tasks you can create depend on your resource package specifications. For more information, see Resource package specifications.

  • You can add only one scheduled performance test task to each performance test scenario.

  • You cannot edit a performance test scenario that has a scheduled task configured.

Schedule a test for a new scenario

When creating a performance test scenario, you can configure it to run as a scheduled task. After creating the scenario, select scheduled performance test when you start the test.

  1. Log on to the PTS console. In the left-side navigation pane, choose performance test > Create scenario, and then click PTS performance test.

  2. On the Scenario configuration and Stress configuration tabs, configure the required parameters. For more information, see Create a performance test scenario and Stress configuration.

  3. In the lower-left corner of the page, click Save and Run Test. In the Note dialog box that appears, set Execution cycle to scheduled performance test and configure the related parameters.

    Note

    To ensure that the scheduled task runs successfully, you must debug the performance test scenario before you schedule the test. For more information, see Debug a scenario.

    Parameter

    Description

    Execution cycle

    Select scheduled performance test.

    Task name

    Enter a task name, up to 30 characters long.

    Execution frequency

    • Select Execute only once and specify the date and time to the minute.

    • Select Execute periodically:

      • Click By Day and select one or more days of the month to run the test.

      • Click By Week and select one or more days of the week to run the test.

      • Click Advanced to write a crontab expression for a custom schedule. For more information, see Crontab expressions.

    Note

    Use only one method to set the schedule: By Day, By Week, or Advanced.

    Notification timing

    Select when to send notifications. You can select one or more options:

    • Notify before the test starts.

    • Notify after the test ends.

    Notification method

    Select a notification channel. Options include SMS, email, and DingTalk, but only DingTalk is currently supported.

  4. Click OK. PTS automatically adds the scheduled task to the test calendar.

  5. Log on to the PTS console. In the left-side navigation pane, choose performance test > Scheduled performance tests.

  6. In the calendar, click the newly added scheduled performance test task to preview it.

Schedule a test for an existing scenario

On the Scheduled performance tests page, you can add an existing performance test scenario to the calendar for a specific date.

  1. Log on to the PTS console. In the left-side navigation pane, choose performance test > Scheduled performance tests.

  2. In the calendar, click the date on which you want to run the performance test.

  3. On the right side of the page, click Create scheduled task, configure the parameters, and then click OK.

    Parameter

    Description

    Task name

    Enter a task name, up to 30 characters long.

    Associated scenario

    From the drop-down list, select the performance test scenario to schedule.

    Note

    If you use a PTS performance test, you must debug the performance test scenario first. Otherwise, you cannot add it to a scheduled task. For more information about how to debug a scenario, see Debug a scenario.

    Execution frequency

    • Select Execute only once and specify the date and time to the minute.

    • Select Execute periodically:

      • Click By Day and select one or more days of the month to run the test.

      • Click By Week and select one or more days of the week to run the test.

      • Click Advanced to write a crontab expression for a custom schedule. For more information, see Crontab expressions.

    Note

    Use only one method to set the schedule: By Day, By Week, or Advanced.

    Notification timing

    Select when to send notifications. You can select one or more options:

    • Notify before the test starts.

    • Notify after the test ends.

    Recipients and notification methods

    Select notification recipients and methods:

    • Recipients: Select an existing contact in PTS.

    • Notification methods: Select a notification channel. Options include SMS, email, and DingTalk, but only DingTalk is currently supported.

    Note

    For information about how to create a contact, see Manage Recipients.

    Force simultaneous start for multiple scenarios

    Select whether to start scheduled performance test tasks for multiple scenarios simultaneously.

Manage scheduled tasks

On the scheduled test calendar, you can select a task on a specific day to view, edit, or delete it.

View and edit a scheduled task

  1. Log on to the PTS console. In the left-side navigation pane, choose performance test > Scheduled performance tests.

  2. In the scheduled test calendar, click a scheduled performance test task to view its details in the right-side panel.

  3. Above the calendar, click Not scheduled this month. In the dialog box that appears, you can view pending tasks for the current month. Click a scenario name to edit it.

Delete a scheduled task

Deleting a scheduled task removes all of its future recurring instances. You cannot delete a single instance of a recurring task. However, records of completed tasks remain in the calendar. You can delete a scheduled task in two ways:

  • Method 1:

    1. Log on to the PTS console. In the left-side navigation pane, choose performance test > Scheduled performance tests.

    2. In the scheduled test calendar, click a specific scheduled performance test task instance.

    3. In the upper-right corner of the page, click Delete. This action removes all future occurrences of this scheduled task.

  • Method 2:

    1. Log on to the PTS console. In the left-side navigation pane, choose performance test > Scenario list.

    2. In the scenario list, find the scheduled performance test task you want to delete and click Unschedule task in the Actions column. This action removes all future occurrences of the task.

Crontab expressions

To define a scheduled task's execution time more precisely, use a crontab expression. You can combine units of minute, hour, day, week, or month.

When you create a scheduled task, set Execution frequency to Execute periodically, and then click Advanced to set the crontab expression.

  • You can specify the execution time by day of the month or day of the week, but not both. If you specify one, you must enter a question mark (?) in the other field to indicate that it is not restricted. For example, if you specify that the task runs on the 1st and 2nd of each month, you must enter ? in the week field.

  • In a crontab expression, use only ASCII characters, such as the asterisk (*) and the question mark (?).

  • Use commas (,) to separate multiple values.

  • Use a hyphen (-) to specify a range of values. For example, entering 1-5 in the Day field specifies the 1st to the 5th of the month.

  • For the day of the week, Sunday is 1 and Saturday is 7. The range for a week is 1-7.

  • Use a forward slash (/) to specify step values. For example, using */2 in the day-of-month field means every two days.

  • A crontab expression consists of five fields:

    • Minute: 0-59.

    • Hour: 0-23, where 0 is midnight.

    • Day (of the month): 1-31.

    • Month: Cannot be modified. Only monthly recurrence is supported.

    • Week (day of the week): 1-7, where 1 is Sunday, 2 is Monday, and so on.

    Crontab expression examples

    • Run at 23:00 every Saturday and Sunday: 0 23 ? * 7,1.

    • Run at 09:30 on the 5th, 15th, and 25th of every month: 30 9 5,15,25 * ?.

    • Run at midnight every two days: 0 0 */2 * ?.