How Can I Get Covered With Cucumber Protractor

My project is built with Django and Angular.
I use a cucumber and chai protractor as my e2e test.
And using "grunt-protractor coverage" to communicate code coverage. I have a question here that if I use jasmine as my protractor structure when I run the nag test, that's just fine. But when I use cucumber, an error occurs.

[launcher] Process exited with error code 1
/Users/paizanmay/Documents/ichef/Superadmin2.0/node_modules/protractor/node_modules/q/q.js:126
                    throw e;
                          ^
Error: Spec patterns did not match any files.
    at Runner.run (/Users/paizanmay/Documents/ichef/Superadmin2.0/node_modules/protractor/lib/runner.js:249:11)
    at TaskRunner.run (/Users/paizanmay/Documents/ichef/Superadmin2.0/node_modules/protractor/lib/taskRunner.js:123:19)
    at createNextTaskRunner (/Users/paizanmay/Documents/ichef/Superadmin2.0/node_modules/protractor/lib/launcher.js:220:20)
    at /Users/paizanmay/Documents/ichef/Superadmin2.0/node_modules/protractor/lib/launcher.js:243:7
    at _fulfilled (/Users/paizanmay/Documents/ichef/Superadmin2.0/node_modules/protractor/node_modules/q/q.js:797:54)
    at self.promiseDispatch.done (/Users/paizanmay/Documents/ichef/Superadmin2.0/node_modules/protractor/node_modules/q/q.js:826:30)
    at Promise.promise.promiseDispatch (/Users/paizanmay/Documents/ichef/Superadmin2.0/node_modules/protractor/node_modules/q/q.js:759:13)
    at /Users/paizanmay/Documents/ichef/Superadmin2.0/node_modules/protractor/node_modules/q/q.js:573:44
    at flush (/Users/paizanmay/Documents/ichef/Superadmin2.0/node_modules/protractor/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js: 355: 11)

I really don't know how to solve
it Is "specs: ['features / store_id_admin.feature']" useless in "protractor grunt coverage"?

THH

+3


source to share


1 answer


It's not like the protractor trampoline coverage was designed to work with CucumberJS. Although I was able to get it to read my list of specs (I moved protractor.conf.js to the root of my application and provided full paths), the plugin expects the specs to be written as JavaScript so that they can be rewritten to collect / push coverage data back ... When your tests run a small service, it runs in the background (cover-collector) to match the coverage data from each scenario.

In theory, CucumberJS also provides similar hooks that can be specified along with step definitions to write data from an object window.__coverage__

after each function / step: https://github.com/cucumber/cucumber-js#after-hooks

(You can see the template used to write coverage data to the collector here: https://github.com/r3b/grunt-protractor-coverage/blob/master/resources/saveCoverage.tmpl )



It might be possible to add a parameter to the plugin to stop it trying to parse / modify the spec files and get coverage data.


Update. I made some tweaks to cover cross-border coverage on my Github fork ( https://github.com/gazoakley/grunt-protractor-coverage ). There's a pull request to bring it back to the actual scope of the trace-protractor: https://github.com/r3b/grunt-protractor-coverage/pull/44

+2


source







All Articles