RallyApps / rally-app-builder

A Node.js command line utility for building apps using the Rally App SDK
MIT License
36 stars 50 forks source link

[QUESTION] Does app builder/test sdk provide coverage support? #88

Closed vaidsu closed 6 years ago

vaidsu commented 6 years ago

Tried to do some local experiments using vanilla istanbul and grunt integration.

Haven't been really successful.

Please suggest if there are better means, until then I will try my best and share the findings.

Thanks.

krmorse commented 6 years ago

Yeah, totally. Here are the docs for how to use it: https://help.rallydev.com/apps/2.1/doc/#!/guide/testing_apps

vaidsu commented 6 years ago

@krmorse thanks for your quick response.

I am done with writing tests and making it work.

The issue is not about writing those, but more about generating coverage for those.

I tried different techniques, vanilla istanbul, karma runner, etc.

I am able to generate coverage to some extent on the example crud app, but for some reason, I guess the dependency is not loaded, so the tests that are passing through grunt is not passing through karma,

Here is the output:

./node_modules/.bin/karma start karma.conf.js 
28 04 2018 12:57:11.596:INFO [karma]: Karma v2.0.2 server started at http://0.0.0.0:9876/
28 04 2018 12:57:11.600:INFO [launcher]: Launching browser Chrome with unlimited concurrency
28 04 2018 12:57:11.608:INFO [launcher]: Starting browser Chrome
28 04 2018 12:57:12.545:INFO [Chrome 65.0.3325 (Mac OS X 10.11.6)]: Connected on socket GPmP82NRivyoe1ErAAAA with id 26199195
Chrome 65.0.3325 (Mac OS X 10.11.6): Executed 0 of 5 SUCCESS (0 secs / 0 secs)
28 04 2018 12:57:13.570:WARN [web-server]: 404: /base/node_modules/rally-sdk2-test-utils/src/sdk/2.1/rui/resources/css/rui-Chrome 65.0.3325 (Mac OS X 10.11.6) Rally.example.test.Crud should create a defect FAILED
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Chrome 65.0.3325 (Mac OS X 10.11.6): Executed 1 of 5 (1 FAILED) (0 secs / 0 secs)

When ran over the grunt test

./node_modules/.bin/grunt test
Running "jshint:all" (jshint) task
>> 1 file lint free.

Running "jasmine:app" (jasmine) task
Testing jasmine specs via PhantomJS

 Rally.example.test.Crud
   ✓ should create a defect
   ✓ should read the defect
   ✓ should update the defect
   when deleting the defect
     ✓ should handle success
     ✓ should handle error

5 specs in 0.82s.
>> 0 failures

Here is the karma.conf

module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine'],
    files: [
      'node_modules/rally-sdk2-test-utils/src/sdk/2.1/sdk-debug.js',
      'node_modules/rally-sdk2-test-utils/dist/sdk2-test-utils.js',
      '*.js',
      'test/*.js',
    ],
    browsers: ['Chrome'],
    singleRun: true,
    reporters: ['progress', 'coverage'],
    preprocessors: {'*.js': ['coverage']},
    client: {
      jasmine: {
        template: 'node_modules/rally-sdk2-test-utils/lib/specs.tmpl',
      },
    },
  });
};

This generates coverage to some extent, but the tests are not passing

screen shot 2018-04-28 at 1 04 18 pm

What do you think I am missing? Please help?