[TIMOB-7749] Drillbit: Add support for creating a sequence of asynchronous operations in a test
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-02-29T09:07:24.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint 2012-05, Release 2.0.0 |
Components | Drillbit |
Labels | drillbit, feature, tooling |
Reporter | Jeff English |
Assignee | Jeff English |
Created | 2012-02-21T18:08:18.000+0000 |
Updated | 2012-03-19T06:23:06.000+0000 |
Description
It would be nice to be able to define a sequence of asynchronous functions that should be executed as part of a single test. For example,
1. Login to a service and verify result (asynchronously)
2. Query data and verify result (asynchronously)
3. Update data and verify result (asynchronously)
4. Logout of service and verify result (asynchronously)
This is especially important for validating REST-based services. While this could be done by putting each step into a separate test, it would be good to be able to define these in-line in a single test to avoid issues that could occur if a developer inserted or moved tests around in the test file.
Example of utilizing this functionality:
You can even push an
async
function on the sequence if an operation does not involve the use of a callback function (see the last operation in this example):PR submitted: https://github.com/appcelerator/titanium_mobile/pull/1479
Here is an example that demonstrates that the sequence can be modified while running. In this case, we need to query the remote database to get a list of existing entries to be deleted. Upon receipt of the list we need to issue a 'remove' request for each entry that is returned. Since we don't know ahead of time how many entries there will be, we query the server and insert additional entries into the sequence.