why My Lead OPA test add Lead fails

简介: why My Lead OPA test add Lead fails

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

It will fail:


image.png


The reason could be analyzed via the below picture:


image.png


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.


image.png


Screenshot for step1

image.png



Screenshot for step2



image.png

Screenshot for step3


image.png


Screenshot for step5


Solution

We would like to achieve the following call sequences:


image.png


As suggested by Diablo, we could try “wait for aggregation” concept and API to fulfill it:

http://p: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.

image.png


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.


image.png

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

image.png

相关文章
|
供应链
PAT (Advanced Level) Practice - 1079 Total Sales of Supply Chain(25 分)
PAT (Advanced Level) Practice - 1079 Total Sales of Supply Chain(25 分)
118 0
PAT (Advanced Level) Practice - 1030 Travel Plan(30 分)
PAT (Advanced Level) Practice - 1030 Travel Plan(30 分)
86 0
2015-03-17 current note creation logic in my task
2015-03-17 current note creation logic in my task
87 0
2015-03-17 current note creation logic in my task
2015-03-18 current note update logic in my task
2015-03-18 current note update logic in my task
73 0
2015-03-18 current note update logic in my task
2015-03-18 - Deliberately pass a wrong note type for my task creation
2015-03-18 - Deliberately pass a wrong note type for my task creation
73 0
2015-03-18 - Deliberately pass a wrong note type for my task creation
header note truncation issue - designed behavior
header note truncation issue - designed behavior
85 0
header note truncation issue - designed behavior
my Lead add Lead test
Created by Wang, Jerry, last modified on Jul 06, 2016
my Lead add Lead test
How to give query view parameter values in APF
How to give query view parameter values in APF
How to give query view parameter values in APF
|
算法 前端开发 弹性计算
译《Time, Clocks, and the Ordering of Events in a Distributed System》
Motivation 《Time, Clocks, and the Ordering of Events in a Distributed System》大概是在分布式领域被引用的最多的一篇Paper了。
877 0
|
SQL 关系型数据库 RDS
9 Easy Steps for Successful Data Migration
Migrate your database without service interruptions with Alibaba Cloud Data Transmission Service
1951 0
9 Easy Steps for Successful Data Migration