cancel
Showing results for 
Search instead for 
Did you mean: 

Force a Fiori Like app to run with Mock data

SandipAgarwalla
Active Contributor
0 Kudos

Hi

We have built a fiori Master Detail application using the newer version of WebIDE ( 1.30). The App runs fine with actual data from oData service.

We can simulate it also with mock data generated by the Mock Server, however for that you need to create a run configuration with mock data on.

Is there a possibility that when ever we call the app thru index.html, it will always run with mock data.

in the earlier versions of MD template generated by WebIDE, there used to be a parameter 'responderOn' which will run it in mock mode. I cant find any similar attributes with the newer versions.

How do we enforce the app to run with mock data always?

Thanks

Sandip

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Sandip,

AFAIK, at moment this is not yet supported. It probably will be in the future.

EDIT:

Well, I retested it right now and it seems to be working. Here what I did:

1) I created a new FIORI app with SAP Web IDE

2) removed any run configuration and created a new one to run just the Component.js file (just to be sure I was doing it in the right way!)

3) opened the Component.js file and added the code


                sap.ui.require([

                                "com/test/products/localService/mockserver"

                ], function(mockserver) {

                                // set up test service for local testing

                                mockserver.init();

                });

in the init function just after the "this.getRouter().initialize();" line.

Pay attention here that you have to replace the path before the "localService/mockserver" string to match the namespace you assigned to your application.

Check my picture here:

4) Then I saved everything and I deployed my app to HCP.

5) I registered the app on FLP and run it from there. It seems working fine.

Let me know if you have any comment.

Regards,

Simmaco

jamie_cawley
Advisor
Advisor
0 Kudos

To follow the design pattern you may want to define it as


  "com/test/products/controller/ErrorHandler",

  "com/test/products/localService/mockserver"

  ], function (UIComponent, Device, models, ListSelector, ErrorHandler, MockServer) {

....

  // create the views based on the url/hash

  this.getRouter().initialize();

  //start mock server

  MockServer.init();

Regards,

Jamie

SAP - Technology RIG

SandipAgarwalla
Active Contributor
0 Kudos

Hello Simmanco

Thanks a lot for your help. That really helped.

Regards

Sandip

Answers (1)

Answers (1)

SandipAgarwalla
Active Contributor
0 Kudos

Hello  

Can you please help? Any inputs?

Best Regards

Sandip