前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >why My Lead OPA test add Lead fails

why My Lead OPA test add Lead fails

作者头像
Jerry Wang
发布2019-06-14 10:36:06
3770
发布2019-06-14 10:36:06
举报

When you perform OPA test for my lead application, test case “add Lead” via this url: It will fail:

clipboard1
clipboard1

The reason could be analyzed via the below picture:

clipboard2
clipboard2

Our OPA test code calls fireLiveChange function. The live change event handling written in My lead application code is called, which performs oModel.read to read possible values for “f”. Since we pass “true” to read API, this read is done asynchronously, that is, the execution flow directly returns to our OPA code. Our OPA test code calls oInput.getSuggestionItems. Unfortunately Items is now still initial, since the asynchronous OData call does not finish yet in timeslot t1. items[0].getText causes the failure of OPA test. Till timeslot t2, OData request is done and success handling is called, to fill the SuggestionItems aggregation. t2 > t1, it is too late now. For detail screenshot of the above five steps, please refer to picture below.

clipboard3
clipboard3

Screenshot for step1

clipboard4
clipboard4

Screenshot for step2

clipboard5
clipboard5

Screenshot for step3

clipboard6
clipboard6

Screenshot for step5

Solution

We would like to achieve the following call sequences:

clipboard7
clipboard7

As suggested by Diablo, we could try “wait for aggregation” concept and API to fulfill it: http://veui5infra.dhcp.wdf.sap.corp:8080/sapui5-sdk-dist/docs/api/symbols/sap.ui.test.matchers.html To be updated soon.

I have added the new matcher mentioned in wiki and now OPA test of add Lead test succeeds.

clipboard8
clipboard8
clipboard9
clipboard9

To summarize, The newly added matcher will lead to an endless loop by a periodical check with polling interval 400 milliseconds by default, as a result the asynchronously executed OData request has enough time to finish. In the end we have the following expected time sequence chart.

clipboard10
clipboard10

If you would like to debug matcher logic, please set breakpoint on line below.

clipboard11
clipboard11
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019年06月13日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Solution
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档