Workflow Testing

Workflow Testing allows you to create sets of different tests to validate user flows are working as expected.

What is Workflow Testing?

Workflow Testing in Xano allows you to quickly build sets of tests that you can use to make sure a specific flow is working as expected. You can think of a 'flow' as a set of separate actions, such as multiple APIs that a user might hit when utilizing your application, or data processing across multiple function stacks.

Workflow Testing allows you to validate these sets or flows with a single click and get instant visibility into your backend functionality.

How do I build workflow tests?

Choose Add Workflow Test in the top-right corner. In the panel that opens, you can give your test a name, description, and add tags for easy access later.

Run Stacks

Run stacks are functions you can add to your workflow tests to run other function stacks, such as APIs, custom functions, and middleware.

Function Name
Use Case

Run API Endpoint

Sends a request to one of your API endpoints and returns the result

Run Addon

Runs an addon

Run Function

Runs a custom function and returns the result

Run Middleware

Runs a middleware and returns the result

Run Trigger

Runs a trigger and returns the result

Run Task

Runs a background task and returns the result

Test Expressions

Test Expressions are functions used typically in conjunction with a Run Stack to determine if the output of a Run Stack is valid.

Function Name
Use Case

Expect a variable to be defined Expect a variable to not be defined

Checks to see if a variable has been defined. Example: You have an API that returns a user object with a name key inside of it. You can use this to check if user.name is defined.

Expect variable to be empty

Checks to see if a variable exists, but is empty. Example: You are calling an external API that is used to process data. If the API call is successful, you know that response.result is empty because the API just returns a status code informing you that the job is being processed.

Expect variable to be false Expect variable to be true

Checks to see if a variable with a boolean data type is returning false or true

Expect variable to be greater than Expect variable to be less than Expect variable to equal Expect a variable to not equal Expect variable to be within

Checks to see if a variable matches the specific condition, such as >, <, =, or is within a certain range.

Expect variable to be null

Checks to see if a variable contains a null value

Expect variable to start with Expect variable to end with

Checks to see if the value inside of a variable starts or ends with a specific value

Expect function to throw

Checks a function to see if it throws an error

Expect function to match

Checks to see if the output of a variable matches a regular expression

Using Workflow Tests

In this example, we've built a workflow test to make sure our login flow works as expected.

We've added a Run Stack function to run our auth/login endpoint, and provided it with a username and password.

If we modify our Run API Endpoint run stack to provide an invalid password, we can see that by running our test again, we get an error. This test has failed because an authToken was not returned.

We can see by running all of our workflow tests the following information:

  • We have 38% coverage. This means that out of all of the function stacks that exist across our backend, 3/8 of them are used in our tests.

  • We have 50% success. This means that out of all of our workflow tests, half of them are successful.

  • To run all of our tests takes less than a second.

Additional Information

  • When you test a function stack that currently is in draft mode, your workflow test will run the drafted version.

Last updated