HarmonyOS 鸿蒙Next:【DevEco Testing应用性能功耗测试】自定义场景化性能测试报告分析时测试步骤丢失

发布于 1周前 作者 eggper 来自 鸿蒙OS

HarmonyOS 鸿蒙Next:【DevEco Testing应用性能功耗测试】自定义场景化性能测试报告分析时测试步骤丢失

执行日志中步骤丢失

cke_9178.png

报告详情中步骤丢失

cke_7176.png

原子用例步骤=14

from hypium import BY
from hypium.advance.perf.application_model.model_base import ModelBase
from hypium.advance.perf.driver_perf.idriver_perf import IDriverPerf
from hypium.advance.perf.driver_perf.tag import SceneType
from hypium.model import UiParam

from dm import APP, APP_NAME

class DMConcertBrowsing(ModelBase): def init(self, uidriver: IDriverPerf, case_id): ModelBase.init(self, uidriver, case_id) self.scene_no = “dm_concert_browsing” self.scene_name = “浏览热门演唱会” self.scene_type = “演唱会场景” self.scene_path = “基础操作场景-浏览演唱会场景” self.driver = uidriver

<span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword">def</span></span></span><span class="hljs-function"> </span><span class="hljs-title"><span class="hljs-function"><span class="hljs-title">setup</span></span></span><span class="hljs-params"><span class="hljs-function"><span class="hljs-params">(self)</span></span></span><span class="hljs-function">:</span></span>
    self.driver.stop_app(APP)
    self.driver.go_home()

<span class="hljs-decorator"><span class="hljs-decorator">@ModelBase.scene_recover</span></span>
<span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword">def</span></span></span><span class="hljs-function"> </span><span class="hljs-title"><span class="hljs-function"><span class="hljs-title">execute</span></span></span><span class="hljs-params"><span class="hljs-function"><span class="hljs-params">(self)</span></span></span><span class="hljs-function">:</span></span>
    icon_pos = self.driver.find_app_in_launcher(APP_NAME)

    self.driver.touch_perf(
        icon_pos,
        tag=self.create_tag(
            step_name=<span class="hljs-string"><span class="hljs-string">"冷启动大麦APP设置"</span></span>, scene_type=SceneType.COLD_START
        ),
    )

    <span class="hljs-comment"><span class="hljs-comment"># 用户等待时间</span></span>
    self.driver.wait(<span class="hljs-number"><span class="hljs-number">1</span></span>)

    <span class="hljs-keyword"><span class="hljs-keyword">for</span></span> index <span class="hljs-keyword"><span class="hljs-keyword">in</span></span> range(<span class="hljs-number"><span class="hljs-number">3</span></span>):
        self.driver.swipe_perf(
            UiParam.UP,
            tag=self.create_tag(
                f<span class="hljs-string"><span class="hljs-string">"精选页向上滑动{index + 1}次"</span></span>, SceneType.NO_PAGE_SWITCH
            ),
        )

    <span class="hljs-keyword"><span class="hljs-keyword">for</span></span> index <span class="hljs-keyword"><span class="hljs-keyword">in</span></span> range(<span class="hljs-number"><span class="hljs-number">3</span></span>):
        self.driver.swipe_perf(
            UiParam.DOWN,
            tag=self.create_tag(
                f<span class="hljs-string"><span class="hljs-string">"精选页向下滑动{index + 1}次"</span></span>, SceneType.NO_PAGE_SWITCH
            ),
        )

    concert = self.driver.find_component(BY.text(<span class="hljs-string"><span class="hljs-string">"演唱会"</span></span>))

    self.driver.touch_perf(
        target=concert,
        tag=self.create_tag(<span class="hljs-string"><span class="hljs-string">"进入演唱会"</span></span>, SceneType.WITH_PAGE_SWITCH),
    )

    <span class="hljs-comment"><span class="hljs-comment"># 用户等待时间</span></span>
    self.driver.wait(<span class="hljs-number"><span class="hljs-number">1</span></span>)

    <span class="hljs-keyword"><span class="hljs-keyword">for</span></span> index <span class="hljs-keyword"><span class="hljs-keyword">in</span></span> range(<span class="hljs-number"><span class="hljs-number">3</span></span>):
        self.driver.swipe_perf(
            UiParam.UP,
            tag=self.create_tag(
                f<span class="hljs-string"><span class="hljs-string">"演唱会页向上滑动{index + 1}次"</span></span>, SceneType.NO_PAGE_SWITCH
            ),
        )

    <span class="hljs-keyword"><span class="hljs-keyword">for</span></span> index <span class="hljs-keyword"><span class="hljs-keyword">in</span></span> range(<span class="hljs-number"><span class="hljs-number">3</span></span>):
        self.driver.swipe_perf(
            UiParam.DOWN,
            tag=self.create_tag(
                f<span class="hljs-string"><span class="hljs-string">"演唱会向下滑动{index + 1}次"</span></span>, SceneType.NO_PAGE_SWITCH
            ),
        )

<span class="hljs-function"><span class="hljs-keyword"><span class="hljs-function"><span class="hljs-keyword">def</span></span></span><span class="hljs-function"> </span><span class="hljs-title"><span class="hljs-function"><span class="hljs-title">teardown</span></span></span><span class="hljs-params"><span class="hljs-function"><span class="hljs-params">(self)</span></span></span><span class="hljs-function">:</span></span>
    self.driver.stop_app(APP)

<button style="position: absolute; padding: 4px 8px 0px; cursor: pointer; top: 8px; right: 8px; font-size: 14px;">复制</button>



关于HarmonyOS 鸿蒙Next:【DevEco Testing应用性能功耗测试】自定义场景化性能测试报告分析时测试步骤丢失的问题,您也可以访问:https://www.itying.com/category-93-b0.html 联系官网客服。

2 回复
这个得等testing更新服务了

有要学HarmonyOS AI的同学吗,联系我:https://www.itying.com/goods-1206.html

回到顶部