coeus python框架的unity命令和响应。

coeus-test-unit的Python项目详细描述


腔统一性

pypitravis

关于

coeus unity是在python的coeus-test包上构建的命令和断言的集合。这些命令支持使用c coeus测试框架进行统一的远程集成测试。

贡献者

设置

只需将需求安装到您的包中。

pipinstallcoeus-test-unity

命令

命令不提供响应验证。你可以使用断言。

importcommandsresponse=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","InputField","text","Hello World")# Finds a FieldInfo | PropertyInfo on the component and attempts to obtain its valuevalue=commands.fetch_component_value(cli,"My/Transform/Target","InputField","text")

断言

由于命令只断言响应消息,因此它们不会验证请求的状态;为此,我们可以使用断言。

importassertions# 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)# Checks if FieldInfo | PropertyInfo on the component equals to the provided valueassertions.assert_component_value_equals(cli,"My/Transform/Target","InputField","text","password")# Awaits a FieldInfo | PropertyInfo on the component to become the provided valueassertions.assert_await_component_value_equals(cli,"My/Transform/Target","InputField","text","password")

高级

变换路径变量

如果您的客户机支持变量替换,您可以简单地将它们传递到您的路径中。例如,如果基于某个可预测变量对变换路径名有不同的变体,则可以将这些变量传递给替换变量。

# {deviceFormfactor} is replaced in client...assertions.assert_await_transform_exists(cli,"Kiosk-{deviceFormFactor}(Clone"),timeout_seconds=10)

转换引用

如果两个或多个同级转换具有相同的名称,则转换路径不明确。这使得很难指定正确的转换,如下例所示:

# Suppose both buttons have the same transform path: "Path/To/Menu/Button"# Fetch button0 position using transform pathbutton0_position=commands.fetch_transform_screen_position(cli,"Path/To/Menu/Button")# Can't fetch button1 position using transform path because transform path is ambiguousbutton1_position=# ???

若要解决此歧义,可以使用转换引用,该引用使用同级索引来补充转换路径,从而为每个转换生成唯一路径。使用fetch_transform命令获取转换引用:

# Suppose both buttons have the same transform path: "Path/To/Menu/Button"# Obtain a transform referencemenu=commands.fetch_transform(cli,"Path/To/Menu")# Fetch button0 position using transform referencebutton0_position=commands.fetch_transform_screen_position(cli,menu.children[0])# Fetch button1 position using transform referencebutton1_position=commands.fetch_transform_screen_position(cli,menu.children[1])

Warning: Transform references are only valid as long as the transform hierarchy doesn't change. If the hierarchy changes (e.g. a transform is created or deleted, or the sibling order changes), you must call fetch_transform again to obtain updated transform references.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java文件分块,获取长度字节   java嵌入式Tomcat不执行jsf页面   java我的数据库中有2个实体,但hibernate返回其中6个。   java如何基于逗号拆分字符串   java取消已经运行的CompletableFutures的预期模式是什么   java如何在informix中从另一个数据库复制表ddl和数据   为什么图片是黑色的?   java根据字符串数组中的单词筛选列表   Java8的集合。平行流有效吗?   Kotlin中的java静态内部类   java如何在GUI中生成一列字符串   javafx如何正确使用高对比度主题?   带空格的javascript Httpurlconnection参数   java如何设置GridBagLayout的约束   java如何在一个线程可能尚未初始化时关闭另一个线程   java将简单时间格式转换为特殊时间格式(hhmmt)   安卓/java阵列重复过滤器的问题   java在队列的链接实现下,入队和出队是如何工作的   java更新sql外键约束