Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

AppTester

Helper class to test that an app (Reflex or Streamlit) starts and runs correctly.

Usage with a task that generates the app: AppTester.test_app_from_task( test_case=self, generate_task_type=GenerateReflexShowcaseApp, app_output_name="reflex_app", input_resources={"resource": table}, )

Usage with an existing AppResource: AppTester.test_app(self, app_resource)

Functions
test_app @staticmethod

Test that an app resource starts and runs correctly.

test_case : TestCase
The unittest.TestCase instance (used for assertions).
app_resource : AppResource
test_app_from_task @staticmethod

Run a task to generate an AppResource, then test that the app starts and runs correctly. It tests that the resource generated by the generate_task_type can be started as an app, that the app process is running, and that the health check endpoint returns a successful response. It also tests that the app process can be stopped.

test_case : TestCase
The unittest.TestCase instance (used for assertions).
generate_task_type : type
The task class that generates the AppResource.
app_output_name : str
The name of the task output port that produces the AppResource.
input_resources : dict[str, gws_core.resource.resource.Resource] | None
Optional dict mapping input port names to resources. Resources will be saved as ResourceModels and connected as sources.
config_values : dict | None
test_app_from_task_runner @staticmethod

Run a task using TaskRunner to generate an AppResource, then test that the app starts and runs correctly. This is a lighter alternative to test_app_from_task that does not require creating a full scenario.

test_case : TestCase
The unittest.TestCase instance (used for assertions).
generate_task_type : type
The task class that generates the AppResource.
app_output_name : str
The name of the task output port that produces the AppResource.
input_resources : dict[str, gws_core.resource.resource.Resource] | None
Optional dict mapping input port names to resources.
config_values : dict | None
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.