Mocking requests are used for developing and testing the applications. It can be also used for some test-driven development in RIA. It helps to develop in asynchronous mode with backend team or fake the results of diesel emissions tests.

To mock request you can use the ‘Ext.ux.ajax.SimManager’ singleton. In the following listing is presented sample mock of the ‘/users.get’ request. The ‘data’ property can get array or function as a value. I used the function to generate data.

Ext.ux.ajax.SimManager.init({
    delay: 600
}).register({
    '/users.get': {
        stype: 'json',
        data: function (ctx) {
            var data = [],
                currentDate = new Date();
            for (var i = 0; i < 600; i++) {
                data.push({
                    firstName: "Muster: " + i,
                    lastName: "Mustermann" + i,
                    dateOfBirth: Ext.Date.add(
                        currentDate,
                        Ext.Date.YEAR,
                        Ext.Number.randomInt(-50, 0)
                    )
                });
            }
            return data;
        }
    }
});

The data are automatically sorted and split in pages.

And the working sample for 6.5.3 version.

In some cases it is better to create different javascript files with different tests scenarios and include the required one.