Tough Day

What is Tough Day 2

"Tough Day 2" is a an application that allows you to stress test the limits of your AEM instance. It can be run out of the box with the default test suite or it can be configured to fit your testing needs. You can watch this recording for a presentation of the application.

How to run Tough Day 2

Download the latest version of Tough Day 2 from the Adobe Repository. After you download the application, you can run it out of the box by providing the host parameter. In the following example, the AEM instance runs locally so the localhost value is used:

java -jar toughday2.jar --host=localhost

The default suite that runs after adding the parameters is named toughday. It contains the following use cases:

Create pages and live copies for them (including rollouts)

Get Homepage

Run queries in querybuilder

Create asset hierarchies

Delete assets

The suite contains 15% write actions and 85% read actions.

To run the suite tests, Tough Day 2 will install its default content package. This can be avoided by setting the installsamplecontent parameter to false, but remember that you should also change the default paths for the tests that you intend to run. If the jar is run without parameters, Tough Day 2 displays the help information.

As a general rule, you can use the application by following this pattern:

Tough Day 2 does not have a clean up step. As a result, it is recommended to run Tough Day 2 on a cloned staging instance and not on the main production instance. The staging instance should be dropped after the tests.

Getting Help

Tough Day 2 offers a wide range of help options that can be accessed from the command line. For example:

java -jar toughday2.jar --help_full

In the table below, you can find the relevant help parameters.

Parameter

Description

Example

--help

Prints out global information, for example: the available actions, predefined suites, run modes and global parameters.

--help_publish

Prints out all the available publishers.

--help_tests

Prints the test classes and their description.

--help_full

Prints all of the above, plus tests, publishers and suite components.

--help --runmode/publishmode type=<Mode>

Lists information about the specified run or publish mode.

java -jar toughday2.jar --help --runmode type=constantload

java -jar toughday2.jar --help --publishmode type=intervals

--help --suite=<SuiteName>

Lists all the tests of a given suite and their respective configurable properties.

java -jar toughday2.jar --help --suite=get_tests

--help --tag=<Tag>

Lists all the items that have the specified tag.

java -jar toughday2.jar --help --tag=publish

--help <TestClass/PublisherClass>

Lists all the configurable properties for the given test or publisher.

java -jar toughday2.jar --help UploadPDFTest

java -jar toughday2.jar --help CSVPublisher

Global Parameters

Tough Day 2 offers global parameters that set or change the environment for the tests. These include the host that is targeted, the port number, the protocol used, user and password for the instance and many more. For example:

The duration of the tests. Can be expressed in (s)econds, (m)inutes, (h)ours and (d)ays.

1d

--timeout=<Val>

How long a test will run before it will be interrupted and marked as failed. Expressed in seconds.

180

--suite=<Val>

The value can be one or a list (separated by commas) of predefined test suites.

toughday

--configfile=<Val>

The targeted yaml configuration file.

--contextpath=<Val>

Instance's context path.

--loglevel=<Val>

The log level for the Tough Day 2 engine.

INFO

ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF

--dryrun=<Val>

If true, prints the resulting configuration and does not run any tests.

false

true or false

Customizing

Customization can be achieved in two ways: command line parameters or yaml configuration files. Configuration files are generally used for large custom suites and they will override the Tough Day 2 default parameters. Command line parameters override both configuration files and the default parameters.

The only way to save a test configuration is to copy it in yaml format. For additional details, see this toughday.yaml configuration and the yaml configuration examples in the sections below.

Adding a New Test

If you do not want to use the default toughday suite you can add a test of your choosing by using the add parameter. The examples below show how to add the CreateAssetTreeTest test either by using command line parameters or a yaml configuration file.

By using command line parameters:

java -jar toughday2.jar --host=localhost --add CreateAssetTreeTest

By using a yaml configuration file:

globals:
host : localhost
tests:
- add : CreateAssetTreeTest

Adding Multiple Instances of the Same Test

You can also add and run multiple instances of the same test, but each instance must have an unique name. The examples below show how to add two instances of the same test either by using command line parameters or a yaml configuration file.

Changing the Test Properties

In case you need to change one or more of the test properties, you can add that property to the command line or the yaml configuration file. To see all the available test properties add the --help <TestClass/PublisherClass> parameter to the command line, for example:

java -jar toughday2.jar --help CreatePageTreeTest

Please keep in mind that yaml configuration files will overwrite the Tough Day 2 default parameters and command line parameters will override both the configuration files and the defaults.

The examples below show how to change the template property for the CreatePageTreeTest test either by using either command line parameters or a yaml configuration file.

Existing tests in a given suite can also be reconfigured using the configparameter. Please note that you must also specify the suite name and the actual name of the test (not the Test Class name). You can find the test name in the name property of the Test Class. For further details on how to find test properties, read the Changing Test Properties section.

In the example below the default asset title for the CreatePageTreeTest (named UploadAsset) is changed to "NewAsset".

Aditionally, you can also remove tests from predefined suites or publishers from the default configuration with the use of the exclude parameter. Please note that you must also specify the suite name and the actual name of the test (not the Test Class name). You can find the test name in the name property of the test class. In the example below, the CreatePageTreeTest (named UploadAsset) test is removed from the toughday suite.

Run Modes

Tough Day 2 can run in one of the following modes: normal and constant load.

The normal run mode has two parameters:

concurrency- concurrency represents the number of threads that Tough Day 2 will create for test execution. On these threads, tests will be executed until either the duration has run out or there are no more tests to execute.

waittime - the wait time between two consecutive test executions on the same thread. The value must be expressed in milliseconds.

The example below shows how to add the parameters by using either the command line:

The constant load run mode differs from the normal run mode by generating a constant number of started test executions, rather than a constant number of threads. You can set the load by using the run mode parameter with the same name.

Test Selection

The test selection process is the same for both run modes and it goes as follows: all tests have a weight property, which determines the likelihood of execution in a thread. For example, if we have two tests, one with a weight of 5 and the other with a weight of 10, the latter is two times more likely to be executed than the former.

Furthermore, tests can have a count property, which limits the number of executions to a given number. After this number is passed, no further executions of the test will occur. All test instances that are already running will finish the run as configured. The following example shows how to add these parameters either at the command line or by using a yaml configuration file.

Due to parallel executions, the actual number of test runs will not be exactly the amount configured in the count parameter. Expect a deviation proportional to the number of running threads (controlled by the concurrency parameter).

Dry Run

A dry run parses all the given input (command line parameters or config files), merging it with the defaults and then outputs the results. It does not execute any of the tests.