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

相关文章
|
3月前
ERROR: No matching distribution found for tb-nightly
ERROR: No matching distribution found for tb-nightly
78 1
PAT (Advanced Level) Practice - 1119 Pre- and Post-order Traversals(30 分)
PAT (Advanced Level) Practice - 1119 Pre- and Post-order Traversals(30 分)
115 0
PAT (Advanced Level) Practice - 1119 Pre- and Post-order Traversals(30 分)
|
供应链
PAT (Advanced Level) Practice - 1079 Total Sales of Supply Chain(25 分)
PAT (Advanced Level) Practice - 1079 Total Sales of Supply Chain(25 分)
130 0
|
C++
PAT (Advanced Level) Practice - 1038 Recover the Smallest Number(30 分)
PAT (Advanced Level) Practice - 1038 Recover the Smallest Number(30 分)
113 0
PAT (Advanced Level) Practice - 1030 Travel Plan(30 分)
PAT (Advanced Level) Practice - 1030 Travel Plan(30 分)
100 0
2015-03-17 current note creation logic in my task
2015-03-17 current note creation logic in my task
102 0
2015-03-17 current note creation logic in my task
my Lead add Lead test
Created by Wang, Jerry, last modified on Jul 06, 2016
100 0
my Lead add Lead test
2015-03-18 current note update logic in my task
2015-03-18 current note update logic in my task
82 0
2015-03-18 current note update logic in my task
|
Shell
History displays the time information
For those of you who use terminals a lot, one of the most common commands is probably history, which allows you to view the history of terminal commands executed
107 0
How does ABAP check table work
Created by Wang, Jerry, last modified on Jan 06, 2017
112 0
How does ABAP check table work