Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ weight: 12

## Introduction

You can use the [Unit Testing](/appstore/modules/unit-testing/) module to test Mendix by calling microflows for whole pieces of functionality. Use unit tests for smaller, more targeted tests at the method-level of your Java code.
You can use [testflows](/refguide/testflows/) or the [Unit Testing](/appstore/modules/unit-testing/) module to test Mendix by calling microflows for whole pieces of functionality. Use unit tests for smaller, more targeted tests at the method-level of your Java code.

As with any automated testing, it is a great supplement for capturing known, expected behavior. For capturing unknown behavior, Mendix recommends risk-based exploratory testing.

## Testing Microflows

Use the Mendix app where you built the module to test your module. The Unit Testing module can help call microflows and actions to aid in testing. See [Testing Microflows with the Unit Testing Module](/refguide/testing-microflows-with-unit-testing-module/) for more information.
Use the Mendix app where you built the module to test your module.

In Studio Pro 11.18 and above, you can use [testflows](/refguide/testflows/), which are in beta. A testflow calls the microflows of your module and uses [Assert](/refguide/assert/) activities to check the results. You run testflows from the [Test Runner](/refguide/test-runner/) pane, and each testflow runs in its own runtime with an in-memory database. Testflows are intended to replace the Unit Testing module.

In earlier versions of Studio Pro, the Unit Testing module can help call microflows and actions to aid in testing. For more information, see the [Testing with the Unit Testing Module](/refguide/testing-microflows-with-unit-testing-module/#unit-testing-module) section in *Testing Microflows*.

## Java Unit Tests {#unit-testing}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ description: "Describes the configuration and usage of the Unit Testing module,

## Introduction

{{% alert color="info" %}}
Studio Pro 11.18 introduces [testflows](/refguide/testflows/) in beta. Testflows let you test your microflow logic in Studio Pro, without installing a module, and they are intended to replace the Unit Testing module. For more information, see [Testflows](/refguide/testflows/).
{{% /alert %}}

The [Unit Testing](https://marketplace.mendix.com/link/component/390/) module enables developers to implement, run, and manage unit tests within Mendix applications. You can test your microflows, Java actions, and other logic by implementing test microflows and JUnit (Java) tests. Use the module to automate testing, detect issues early, and improve code quality.

### Limitations
Expand Down Expand Up @@ -208,4 +212,4 @@ The `completed` value will be `false` as long as the test run is not finished. T

## Read More

* [Testing Microflows with the Unit Testing Module](/refguide/testing-microflows-with-unit-testing-module/)
* [Testing Microflows](/refguide/testing-microflows-with-unit-testing-module/)
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ There are the following type of modules:
| --- | --- | --- |
| [Pages](/refguide/pages/) | [Data view](/refguide/data-view/), [data grid](/refguide/data-grid/), [table](/refguide/table/), [text box](/refguide/text-box/) | Forms are used to create a user interface for the end-user. They are composed of components that are called [widgets](/appstore/widgets/). |
| [Microflows](/refguide/microflows/) | [Activities](/refguide/activities/), [sequence Flow](/refguide/sequence-flow/) | Microflows describe the logic of your app. They are composed of activities that manipulate objects and interact with the client. |
| [Testflows](/refguide/testflows/) (beta) | [Assert](/refguide/assert/), [activities](/refguide/activities/) | Testflows test the logic of your app. You create them in the **Testing** node of a module and run them from the [Test Runner](/refguide/test-runner/) pane. |
| [Enumerations](/refguide/enumerations/) | | An enumeration is a set of predefined values (for example, in a web shop, an enumeration called MemberType could have the values Gold and Silver). |

## Page Resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Application logic in Mendix can be implemented via [microflows](/refguide/microf

Microflows and nanoflows are short-lived in nature. They can perform actions such as creating and updating objects, customizing button functionalities, showing pages, and making choices. For example, you can use a microflow to customize a **Save** button for validating end-users' input data. For more instructions, see the [Creating Application Logic](/quickstarts/part1/#create-application-logic) section in *Building a Responsive Web App*. An example of a nanoflow is to use it to create a button that allows end-users to take a picture. For more instructions, see the [Creating Application Logic](/quickstarts/part2/#creating-application-logic) section in *Adding a Native Mobile App*.

Microflows run in the runtime server and can therefore not be used in offline apps, while nanoflows run directly on the client side (that is, on the browser/device), and can be used in an offline app. For more details on their differences, see the [Differences between Microflows and Nanoflows](/refguide/microflows-and-nanoflows/#differences) section in *Microflows and Nanoflows*.
Microflows run in the runtime server and can therefore not be used in offline apps, while nanoflows run directly on the client side (that is, on the browser/device), and can be used in an offline app. For more details on their differences, see the [Differences between Microflows and Nanoflows](/refguide/microflows-and-nanoflows/#differences) section in *Microflows, Nanoflows, and Testflows*.

Workflows represent a long-lived process. They are used to build extendable processes and are fully integrated with other editors, such as the microflow editor and the page editor. The main difference of workflows from microflows and nanoflows is from a waiting aspect—the workflow is paused until it gets an input from an end-user. An example of a workflow is when an employee sends a business travel request to get approved by their manager. Sending the travel request will trigger the start of the workflow and then the workflow is paused until a manager approves or rejects the request by clicking a button. For more information on workflow definitions, properties, and usages, see [Workflows](/refguide/workflows/).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
title: "Microflows and Nanoflows"
title: "Microflows, Nanoflows, and Testflows"
url: /refguide/microflows-and-nanoflows/
weight: 10
description: "Presents an overview of microflows and nanoflows."
description: "Presents an overview of microflows, nanoflows, and testflows."
---

## Introduction

Microflows and nanoflows allow you to express the logic of your application. They can perform actions such as creating and updating objects, showing pages, and making choices. It is a visual way of expressing what traditionally ends up in textual program code.

Explore the documentation for details on microflow and nanoflow definitions, properties, and usages.
Testflows use the same visual language to test the logic of your application. For more information, see [Testflows](/refguide/testflows/).

Explore the documentation for details on microflow, nanoflow, and testflow definitions, properties, and usages.

* [Microflows](/refguide/microflows/)
* [Nanoflows](/refguide/nanoflows/)
* [Testflows](/refguide/testflows/)
* [Sequence Flow](/refguide/sequence-flow/)
* [Activities](/refguide/activities/)
* [Decisions](/refguide/decisions/)
Expand Down Expand Up @@ -49,3 +52,17 @@ Below presents a list of main differences between microflows and nanoflows:
* Because nanoflows use JavaScript libraries and microflows use Java libraries, there can sometimes be slight differences in the way [expressions](/refguide/expressions/) are executed.
* When used in nanoflow activities, expressions do not support the following objects and variables: `$latestSoapFault`, `$latestHttpResponse`, `$currentSession`, `$currentUser`, `$currentDeviceType`.
* Nanoflows are not run inside a transaction. So, if an error occurs in a nanoflow, it will not roll back any previous changes.

## Testflows {#testflows}

{{% alert color="warning" %}} This feature is in beta. For more information, see [Release Status](/releasenotes/release-status/). {{% /alert %}}

Testflows test the logic of your app. You build a testflow in the same way as a microflow, and like microflows, testflows run in the runtime server. A testflow can use the same activities as a microflow, plus [testing activities](/refguide/activities/#testing-activities) such as Assert, which check whether your logic gives the result you expect.

Testflows differ from microflows in the following ways:

* You create testflows in the **Testing** node of a module.
* A testflow cannot have parameters and does not return a value.
* You do not call a testflow from your app. Instead, you run testflows from the **Test Runner** pane in Studio Pro.

For more information, see [Testflows](/refguide/testflows/).
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ weight: 40

## Introduction

Activities define the actions that are executed in a microflow or a nanoflow.
Activities define the actions that are executed in a microflow, a nanoflow, or a testflow.

There are different types of activity, and they are grouped together in the Studio Pro **Toolbox**. All the activities are listed below. Click on each activity for more details.

{{% alert color="info" %}}
Most activities can be used in both microflows and nanoflows. However, some can only be used in one of these types of flow, or the behavior may differ between in microflows and in nanoflows. For more information, see the [Differences between Microflows and Nanoflows](/refguide/microflows-and-nanoflows/#differences) section in *Microflows and Nanoflows*.
Most activities can be used in both microflows and nanoflows. However, some can only be used in one of these types of flow, or the behavior may differ between in microflows and in nanoflows. For more information, see the [Differences between Microflows and Nanoflows](/refguide/microflows-and-nanoflows/#differences) section in *Microflows, Nanoflows, and Testflows*.

A [testflow](/refguide/testflows/) can use all the activities that are available in microflows, as well as [testing activities](#testing-activities).
{{% /alert %}}

## Object Activities
Expand Down Expand Up @@ -122,6 +124,20 @@ These activities can only be used in microflows.
| {{< figure src="/attachments/refguide/modeling/application-logic/microflows-and-nanoflows/activities/increment-counter.png" alt="increment-counter" link="/refguide/metrics-increment-counter/" max-width=55% class="no-border" >}} | [Increment counter](/refguide/metrics-increment-counter/) | Allows you to increment a counter by 1. |
| {{< figure src="/attachments/refguide/modeling/application-logic/microflows-and-nanoflows/activities/gauge.png" alt="gauge" link="/refguide/metrics-gauge/" max-width=55% class="no-border" >}} | [Gauge](/refguide/metrics-gauge/) | Allows you to specify the value of a gauge. |

## Testing Activities {#testing-activities}

{{% alert color="warning" %}} This feature is in beta. For more information, see [Release Status](/releasenotes/release-status/). {{% /alert %}}

{{% alert color="info" %}}
These activities can only be used in [testflows](/refguide/testflows/).
{{% /alert %}}

[Testing activities](/refguide/testing-activities/) are used to check the results of the logic you test.

| Name | Description |
| --- | --- |
| [Assert](/refguide/assert/) | Checks whether a condition is true. If the condition is not true, the testflow stops and fails. |

## Email Activities

{{% alert color="info" %}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "Testing Activities"
url: /refguide/testing-activities/
weight: 83
description: "Describes the testing activities that you can use in testflows."
beta: true
---

{{% alert color="warning" %}} This feature is in beta. For more information, see [Release Status](/releasenotes/release-status/). {{% /alert %}}

{{% alert color="info" %}}
These activities can only be used in testflows.
{{% /alert %}}

## Introduction

The activities described in this document are in the **Testing activities** section of the **Toolbox**. This section is only available when you edit a [testflow](/refguide/testflows/).

The following are the testing activities you can use in your testflow:

* [Assert](/refguide/assert/) – checks whether a condition is true, and stops and fails the testflow if it is not

## Read More

* [Testflows](/refguide/testflows/)
* [Activities](/refguide/activities/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: "Assert"
url: /refguide/assert/
weight: 10
description: "Describes the Assert activity, which checks a condition in a testflow."
beta: true
---

{{% alert color="warning" %}} This feature is in beta. For more information, see [Release Status](/releasenotes/release-status/). {{% /alert %}}

{{% alert color="info" %}}
This activity can only be used in testflows.
{{% /alert %}}

## Introduction

The **Assert** activity checks whether a condition is true. Use it in a [testflow](/refguide/testflows/) to check that the logic you test gives the result you expect, for example that a microflow returns the right value or changes an object in the right way.

If the condition is true, the testflow continues. If the condition is not true, the Assert activity fails: the testflow stops immediately and the **Test Runner** pane shows the testflow as failed, together with the failure message.

A testflow passes when it reaches its end without a failed Assert activity or another error.

## Properties

The **Assert** properties pane consists of the following sections:

* [Action](#action)
* [Common](#common)

## Action Section {#action}

The **Action** section of the properties pane shows the action associated with this activity.

You can open a dialog box to configure this action by clicking the ellipsis (**…**) next to the action.

You can also open the dialog box by double-clicking the activity, or right-clicking the activity and selecting **Properties**.

### Target Expression {#target-expression}

The condition that you want to check. The target expression is an [expression](/refguide/expressions/) that must evaluate to a Boolean. The Assert activity passes when the expression evaluates to `true`, and fails otherwise.

This property is required.

For example, to check that a microflow called from the testflow returned a total of 100, use the following target expression:

```text
$Total = 100
```

### Failure Result Expression {#failure-result-expression}

The message that is shown when the Assert activity fails. The failure result expression is an [expression](/refguide/expressions/) that must evaluate to a string. Use it to explain what went wrong, for example by including the actual value:

```text
'Expected a total of 100, but the total was ' + toString($Total)
```

This property is optional. If you do not set it, or if it does not evaluate to a string, the failure message names the target expression that did not evaluate to `true`.

## Common Section {#common}

{{% snippet file="/static/_includes/refguide/microflow-common-section-link.md" %}}

## Error Handling {#error-handling}

A failed Assert activity must always stop the testflow, so that the test fails. For this reason, the following rules apply:

* The [error handling type](/refguide/microflow-element-common-properties/#error-handling) of an Assert activity is always **Rollback**. You cannot choose another error handling type.
* If you place an Assert activity inside a [loop](/refguide/loop/), the error handling type of that loop must be **Rollback**. This also applies to every loop that contains that loop. Otherwise, the loop would continue with the next iteration after a failed Assert activity, and Studio Pro shows a consistency error.

## Read More

* [Testflows](/refguide/testflows/)
* [Testing Activities](/refguide/testing-activities/)
* [Error Handling in Microflows](/refguide/error-handling-in-microflows/)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: "Presents an overview of all the elements that can be used in a mic

Microflows allow you to express the logic of your application. A microflow can perform actions such as creating and updating objects, showing pages, and making choices. It is a visual way of expressing what traditionally ends up in textual program code.

Microflows run in the runtime server and can therefore not be used in offline apps. For application logic within offline apps, see [Nanoflows](/refguide/nanoflows/). For information on how nanoflows and microflows differ, see the [Differences between Microflows and Nanoflows](/refguide/microflows-and-nanoflows/#differences) section in *Microflows and Nanoflows*.
Microflows run in the runtime server and can therefore not be used in offline apps. For application logic within offline apps, see [Nanoflows](/refguide/nanoflows/). For information on how nanoflows and microflows differ, see the [Differences between Microflows and Nanoflows](/refguide/microflows-and-nanoflows/#differences) section in *Microflows, Nanoflows, and Testflows*.

This page is a summary of the elements which make up a microflow, together with their visual representation within the microflow. It also covers [keyboard support](#keyboard) when editing microflows.

Expand Down
Loading