Skip to content

UPact in UPstudio

Create UPact (UPstudio) Project

To run tests in this style, an additional project is needed where the test classes can be generated. For this use the wizard:

  1. Right click on the package/folder where the project shall be created, then chose New > Other...
  2. Select the UPact (UPstudio) wizard and follow the instructions.

Sample Project

  • Import swiss.avm.up.samples.handling into the workspace. It is an UP sample project where controller and tests are already defined.

    • swiss.avm.up.samples.doc may be imported as well to satisfy a dependency of the UP sample project but is technically not needed.
  • Clone swiss.avm.up.samples.platform into the platform folder of the ...sample.handling project (ideally declare as git submodule). This folder contains the target folders and sample projects of different platforms.

  • Create the UPact (UPstudio) Project with the wizzard. swiss.avm.up.samples.handling.test.upstudio is an example of such a project. It can be imported and used, as well. (Make sure the project dependency is set to the UP sample project.)

Note

  • The content of the project, created by the wizard, must not be altered manually.
  • If the project appears to be broken, it can be scrapped and created again with the UPact (UPstudio) wizard.
  • see also UP Knowledge Base: search term: UPact Run Styles

Set Credentials

In case of a B&R or a Siemens target system, UPact needs to connect by OPC-UA. The target system must provide a user for UPact to connect with. Declare the credentials of this user to UPact by right clicking on config, then choosing UPact: Set OPC-UA Credentials. In the pop-up chose the target configuration and set username and password.

Note

  • The credentials are stored in the workspace. The credentials need to be set again for the same project in a different workspace.
  • Credentials can also be deleted in the pop-up by choosing the target and hitting Delete Credentials
  • A Siemens simulation target does not support OPC-UA password authentification. 'Anonymous' must be set as user, any string as password.

Run

  1. Generate Tests: Right click on the UPact (UPstudio) Project, then Generate Code (or Force Generate Code)
  2. Run(/Debug) test suite instance:

Note

  • The test suite instances only appear after the tests have been generated.
  • Changes in tests or suites only have effect after the tests have been generated again.
  • Make sure the credentials are set before generating the tests. After changes generate again.

Report

A new JUnit tab appears automatically while running. There, results and failure trace are shown. A detailed log can be seen in the Console:

Note

The report is lost when running another or the same test suite instance again!