Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

QUnit testing for SAP UI5 apps

$
0
0

Hi All,

 

 

I am trying to implement QUnit testing for my UI5 app. As mentioned in some articles I have created my test.js file to write all the test cases, one qunit.html file for bootstrapping libraries including test.js and mycontroller.js files. All my functionalities are in mycontroller.js which I want to test.

 

Now my issue is, when I am trying to test the methods which are directly written inside other JS files, I am able to do that but when I am trying to test methods of controller file, its shows me method is undefined.

 

I suspect the reason is my controller has following structure.And when I am trying to access the method using "MyController.myMethod" the test.js file is not able to catch the method.

 

MyController.js

 

sap.ui.controller("MyController", {

 

myMethod: function(){}

 

}

 

test.js

 

QUnit.test( "Sample test", function(  ) {

      ok(MyController.myMethod, "Employee type Test Passed!" );

});

 

 

Can you please suggest a way how we can access methods of controller file?

 

Regards,

Anupriya


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>