Getting Started

Start testing in prod

Prerequisites

The asserted CLI requires at least Node v10. Check which version of Node you have installed with:

node -v

If you do not have Node installed, or have the wrong version, we recommend installing Node using one of the following:

Installation

Use NPM to globally install the asserted CLI:

npm i -g asrtd

At any time you can run the following to get a full breakdown of all CLI commands:

asrtd --help

Login to the CLI with:

asrtd login

This will open a browser to Token Management so you can create a token and paste it into the interactive prompt. Tokens are associated with the user, not the project, and take on all of the abilities of that user.

Initialize Routine

Usually routines are associated with a specific git repo or project. Move to the directory where you want to create the test files associated with a routine.

cd my-project-repo/

Run the following command to create a .asserted directory with all the necessary asserted dependencies and configuration:

astrd init

Inside .asserted, you'll find:

routine.json    ## Routine configuration with interval and mocha config
package.json    ## NPM package defining the (currently) fixed set of dependencies available during testing
examples/       ## Directory containing examples, can be modified or removed  

Your routine is now configured, but only contains examples. To get an idea of how everything works, lets push the current version with the examples.

asrtd push

This will push the current version of the code to asserted.io and you should start seeing results in the dashboard within a few seconds.

Downtime Notifications

Once you have a routine running, you'll want to know if it detects any errors.

Go to the settings page of that routine within asserted.io to add a notification configuration.

You can be notified by email or Slack webhook, or by phone if you have a paid plan or have purchased extra SMS.

Any routines that do not have notifications configured are disabled 48 hours they are created. You can re-enable them at any time.

You'll receive an email before this happens, but there is no point in running a routine continuously that doesn't have any way of notifying someone of downtime.

Development

From here on out, it works mostly like writing any other Mocha test. The free plans only have a fixed set of dependencies, but the paid plans can include any dependencies you wish. Check out Dependencies for more on that.

You can create whatever tests or files you'd like inside the .asserted directory and they'll be included in the next push.

By default, Mocha will run any files with the .asrtd.js suffix as tests. Though this can be configured inside the routine.json file.

Running Locally

To run tests locally, you can use:

asrtd run

The results will look something like:

Running Online

In the event that you have an issue that only seems to manifest when run online, you can use the following option to run the test inside asserted.io:

asrtd run --online

Online runs are rate-limited to prevent abuse, and should only be used to debug issues.

Last updated