Skip to main content

Testing a Workflow

After building, it's time to test our Workflow. Here it is important to understand what are Threads: a thread is a single Workflow execution. It's created whenever a starting stage is triggered (either a Form, a Job or a Hook). Know more about Threads in here.

Running a Workflow

To test your Workflow, navigate to the "Threads" tab in the sidebar.

There you'll find a Kanban view of all threads you initialize.

Each column represents a stage in your Workflow and each card represents a thread. Cards move across stages according to the logic you set in the Workflow editor. Columns can be shown, hid and rearranged as you please.

To begin testing, place the stages in the correct order – first Onboarding and then Greeting.

Run and fill the Onboarding form. After you finish, watch how the card has moved along to Greeting automatically, carrying with it the variable name. This happened because our Form script uses the set_data function to store the variable name in the thread. Check out the Form's script to see the implementation.

Since we set the name variable, we can use it in the code of our following stages using get_data. Let's try that.

Go to the Greeting script's editor. Change the code to:

import abstra.workflows as aw

name = aw.get_data("name")
print(f"Hello, {name}!")

Run the Onboarding script again to create a new thread. After that, a new successful card will move to the Greeting stage.

Click on the card to open up Thread Details and on the Greeting stage to see Stage Details. Here you can view logs from the stage's execution, which include our "Hello" statement.

This is a simple example. You can use the data stored in your thread in more useful ways, such as inputs for APIs, custom ML models and more.

info

Don't worry about starting too many threads while developing and testing. When you shut down your editor, all threads will be deleted.