Friday, May 23, 2014

unit testing using karma in angularjs, steps to install karma to create the testcases in angularjs

open cmd prompt and paste the below command and click eneter

npm install -g karma   ---> to install the karma

after take the path of Test Folder created in our project above ( i.e copy the path of Test folder )

Then goto again cmd prompt...cd here pate the path and click enter

again cmd prompt paste the below command and click enter it will ask few qiestions like jsamine yes  require.js no then 3 times enter


karma init karma.conf.js  ---> here we it is used to create the configuration file, in this we need to specify the folder paths
                                angular.js, angular-mock.js ( this file also required to testing. )


then goto Test folder here karma.config.js file is created, inside this file,

find the filles:[  here we need to specify the paths of angular.js angular-mockup.js paths and our test files created by us ]

Then if we want to run our test cases in cmd prompt paste the below command and click enter it will automaticxally execute the test cases written by us.

karma start karma.conf.js  ---> to run karma i.e executing our test cases.


Note:
ng--sounds like angular that's why called ng

from html angle brackets name given angularjs

No comments:

Post a Comment