Test#

This page provides guidance for solution developers on how to use the testing fixtures provided by the ansys.saf.glow.testing pytest plugin for SAF GLOW Engine-based solutions. Pytest discovers the plugin automatically; no fixture imports or pytest_plugins configuration are required.

The primary fixtures are:

  • client_project: Enables backend testing, giving you access to a GLOW client to interact with your solution’s API. With this fixture, you can test transaction methods, operate with your step fields and validate project-level operations. The client is initiated with a random project for every single test.

  • init_dashclient: Enables frontend testing of your Dash callbacks and UI logic. You can then import your callbacks and execute them, also using the project_name fixture.

  • mock_product_instance: Extend backend testing to support transactions that use product instances, either in a shared or unshared way, without having to actually run the product.

In all cases, you don’t need to externally launch your solution. The fixtures automatically launch and interact with your Solution API in a process-based way using FastAPI’s TestClient. All data is stored in temporary directories. Furthermore, none of them require changes in your solution implementation or configuration.

These fixtures help you write robust tests for both backend logic and frontend user interfaces, ensuring your solution works correctly in real-world scenarios while keeping tests isolated.

Quick start guide

Get started with installation and your first test.

Quick start guide
Solution API

Test backend logic using the client_project fixture.

Solution API testing
Solution UI

Test Dash callbacks and UI logic using init_dashclient.

Solution UI testing
Product Instances

Test transactions with mocked Ansys product instances.

Product instance testing
Other fixtures

Configure solution environments and use additional utilities.

Other fixtures
Advanced techniques

Advanced patterns for reusing setup code and complex scenarios.

Advanced techniques
End-to-end testing

Test the complete install, package, launch, API, and browser lifecycle.

End-to-end testing