码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Espresso Test 7: Idling resource


    文章目录

    • 1.0 知识点
    • 2.0 Idling resources
    • 参考

    这是 Espresso UI 测试系列的第七篇文章。这篇主要是讲述 idling resources 的测试。

    代码来源于 youtube 视频:https://www.youtube.com/watch?v=_96FT7E6PL4&list=PLgCYzUzKIBE_ZuZzgts135GuLQNX5eEPk&index=15&t=4s

    1.0 知识点

    Espresso idling resources
    有时候我们进行异步操作任务,然后用返回的结果更新 UI, 这是常见的情况。这个时候,如果在进行 UI test,由于结果还没返回,这个是就会失败。

    为了解决这个问题,就需要用到 idling resources 解决。

    idling resources 常用的场景

    • 从网络或本地加载数据
    • 和数据库建立链接或回调
    • 在使用到 Service 的时候
    • 进行一些比较复杂的业务逻辑的时候

    idling resources 常用的实现类

    • CountingIdlingResource
      Maintains a counter of active tasks. When the counter is zero, the associated resource is considered idle. This functionality closely resembles that of a Semaphore. In most cases, this implementation is sufficient for managing your app’s asynchronous work during testing.

    • UriIdlingResource
      Similar to CountingIdlingResource, but the counter needs to be zero for a specific period of time before the resource is considered idle. This additional waiting period takes consecutive network requests into account, where an app in your thread might make a new request immediately after receiving a response to a previous request.

    • IdlingThreadPoolExecutor
      A custom implementation of ThreadPoolExecutor that keeps track of the total number of running tasks within the created thread pools. This class uses a CountingIdlingResource to maintain t

  • 相关阅读:
    华为机试 - 最大股票收益
    校园二手交易系统,二手交易网站,闲置物品交易系统毕业设计作品
    Pytorch学习笔记5——经典CNN
    如何构建一个 NodeJS 影院微服务并使用 Docker 部署
    逐句回答,流式返回,ChatGPT采用的Server-sent events后端实时推送协议Python3.10实现,基于Tornado6.1
    如何快速下载微信视频号的视频?简单几步轻松搞定
    如何通过pywinauto开始PC端自动化
    seaborn笔记:绘制点的分布
    一文盘点估值超过1亿美元的NFT项目
    规则引擎入门-基于easy-rules
  • 原文地址:https://blog.csdn.net/yxhuang2008/article/details/127685869
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号