Unity commands and responses for coeus-python-framework.
Project description
Coeus-Unity
About
Coeus-Unity is a collection of commands and assertions built on coeus-test
package for python. These commands support remote integration tests in Unity with the use of the C# Coeus test framework.
Contributors
Setup
Simply install the requirement into your package.
pip install coeus-test-unity
Commands
Commands offer no response validation. You can use assertions for that.
import commands
response = commands.query_transform_exists(cli, "My/Transform Hierarchy/Object (Clone)")
response = commands.query_scene_loaded(cli, "AppSetup")
response = commands.query_renderer_visible(cli, "My/Target/Object (Clone)")
response = commands.await_transform_exists(cli, "My/Transform Hierarchy/Object (Clone)")
# Waits for renderer to become not visible based on False...
response = commands.await_renderer_visible(cli, "My/Transform Hierarchy/Object (Clone)", False)
response = commands.await_scene_loaded(cli, "AppSetup")
# Finds a FieldInfo | PropertyInfo on the component and attempts to assign the value (String | Number | Boolean)
commands.assign_component_value(cli, "My/Transform/Target", "Text", "text", "Hello World")
Assertions
Since commands only assert the response message, they don't verify the state being requested; for this we can use the assertions.
import assertions
# Fails immediately if transform doesn't exist...
assertions.assert_transform_exists(cli, "Some/Path")
# Fails immediately if scene not loaded...
assertions.assert_scene_loaded(cli, "MyScene")
# Awaits for the scene to be loaded, fails when exceeded...
assertions.assert_await_scene_loaded(cli, "MyScene")
# Awaits for a transform to exist by timeout, fails when exceeded...
assertions.assert_await_transform_exists(cli, "Some/Path", timeout_seconds=10)
# Awaits for a renderer to be visible by timeout, fails when exceeded...
assertions.assert_await_renderer_visible(cli, "Some/Path", timeout_seconds=10)
# Awaits for all transforms to exist by timeout, fails when exceeded...
assertions.assert_await_all_transforms_exist(cli, ["Some/Path1", "Some/Path2"], timeout_seconds=10)
# Awaits for any of the transforms to exist by timeout, fails when exceeded...
assertions.assert_await_any_transforms_exist(cli, ["Some/Path1", "Some/Path2"], timeout_seconds=10)
Advanced
Transform Path Variables
If your client supports variable replacement, you can simply pass them into your paths. For instance if you have different variations on transform path names based on some predictable variable, you can pass those in for replacement.
# {deviceFormfactor} is replaced in client...
assertions.assert_await_transform_exists(cli, "Kiosk-{deviceFormFactor}(Clone"), timeout_seconds=10)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for coeus_test_unity-0.1.8-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b62f64625753c161b951211180eadfd69277307f411ce21b486e29723a4fc3e2 |
|
MD5 | 2c86de6bd3d3df3fc93827897a6cafc1 |
|
BLAKE2b-256 | 69afb933e28bc95a420bad3ab65c7255a4d2928c7275602c97eff7cce348d6e6 |