MTA HOW TO’s

Index

Index

How can MTA access my Mendix projects?

How can I create an API key for my Mendix account?

How can MTA access the environment that my Mendix App is running on?

How can I add the MTA Plugin user to my Mendix project?

How can MTA test logic that exists only in pages?

How can I test an API in MTA?

Test a REST call

Test a published REST service


How can MTA access my Mendix projects?

To access Mendix projects, the user who logs in to MTA must be linked to a Mendix user.

How can I create an API key for my Mendix account?


How can MTA access the environment that my Mendix App is running on?

After MTA can access the projects linked to the Mendix user, the Mendix model can be downloaded for a selected revision. However, to communicate with the environment the App is running on, the MTA Plugin User must be linked as well.

Note: If this check is performed three times unsuccessfully because the password is incorrect, Mendix can temporarily block the user.


How can I add the MTA Plugin user to my Mendix project?

Download the MTA plugin module from Github with the highest Mendix version possible for your project. Check the version that is displayed on the Plugin. It represents the lowest supported Mendix version, all higher Mendix versions are supported.

https://github.com/Menditect/MENDITECT-MTA-Plugin/releases   

Import the MTA plugin module package in your test application as a new module.

Make sure to delete any old JAR files like mta-plugin-***.jar from the userlib subfolder in your project directory.

Create a user role 'MTAPluginUser' and make sure not to select any modules in this step

Select the following roles for user role 'MTAPluginUser'

        'MTAPluginUser' from MTAPlugin module

        'User' from System module

        'User' from Administration module

Go to navigation and create a role-based home page for MTAPluginUser for the primary navigation layout

        Select Edit. Mendix shows page 'Role-based home pages'

        Select New. Mendix shows page 'Select user role'

        Select user role 'MTAPluginUser'

        Select target and select page HomepageMTAPluginModule

Repeat this step for all other navigation layouts in use (tablet, phone, hybrid)

Start the test application and login with a user role that has Create rights on Account

Create a local user (not a web service user) with the role 'MTAPluginUser'. Give the user a name and note it for later.


How can MTA test logic that exists only in pages?

There can be different scenarios in a Mendix project where logic exists in pages. For every scenario, there is a different solution to test the logic in MTA. In the case of a microflow being executed from a page, these are the steps to follow:

Other frontend logic not concerning microflows, like frontend validation or visibility constraints, can be simulated in MTA.


How can I test an API in MTA?

Testing an API means creating an integration test where two apps communicate. One hypothetical app (A) executes a REST call. The other app (B) hosting a REST service, will answer. In MTA it is not possible to directly execute a REST call or host a REST service, but it is possible to use the microflows where the REST call or service depends on.

Test a REST call

To test app (A), a microflow that performs the REST call can be used. This microflow is executed from MTA, and will contain the following elements:

  1. input parameters being used in the REST call;
  2. a create variable action where the URL to the API is constructed;
  3. the REST call, yielding a JSON string;
  4. executing the submicroflow containing any custom logic;
  5. optionally any output parameters to be used in following test steps in MTA.

Alternatively, only the submicroflow containing the logic could be used for unit testing. This means however the JSON string must be manually entered in MTA, using a Create Object test step.

Finally the steps in MTA to test are:

  1. execute above microflow with the necessary parameters;
  2. a retrieve object, with the output of test step 1, containing an assert (either on object count, or on attribute, depending on the expected result).

Test a published REST service

To test app (B), the microflow is executed that is part of the REST operation.

To find this microflow, open the Published REST service in Mendix Studio Pro en select Show for that REST operation:

This microflow will contain the same input parameter data as the microflow executing the REST call for app (A), but the parameters are typed. For example:

The output of this microflow is an httpresponse.

Finally the steps in MTA to test are:

  1. execute above microflow with the necessary parameters;
  2. retrieve object, with the output of test step 1 (httpresponse), and one or more asserts on the attributes of the httpresponse, for example “StatusCode = 200”.