cancel
Showing results for 
Search instead for 
Did you mean: 

Automate the qunit test case in SAP UI5 using grunt

0 Kudos

Hi all,

i moved the code to github and cloned the same on my local machine.

I am trying to run qunit over command line using grunt.

grunt file :

module.exports = function (grunt)

{ 'use strict';

grunt.initConfig({

qunit: { all: ['/webapp/test/unit/unitTests.qunit.html'] } });

grunt.loadNpmTasks('grunt-contrib-qunit');

grunt.registerTask('default', ['qunit']);

};

It's running but unable to run the test files as the results shows 0 tests.

I am using trial license of SAP IDE.

Please help.

abdel_dadouche
Active Contributor
0 Kudos

do you have any error message to share?

0 Kudos

Hi Abdel, PFB error message.

java -jar mta.jar --mtar com.sap.ui5.demo2.mtar --build-target=NEO build

SAP Multitarget Application Archive Builder 1.1.19

Module "Sample_UI5App": invoking npm.cmd install
Module "Sample_UI5App": command output
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\@ui5\cli\node_mod
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted

Module "Sample_UI5App": invoking grunt
Module "Sample_UI5App": command output
Running "qunit:all" (qunit) task
>> 0 tests completed with 0 failed, 0 skipped, and 0 todo.
>> 0 assertions (in 0ms), passed: 0, failed:
0 (node:4068) UnhandledPromiseRejectionWarning: Error: Protocol error (Page.addScriptToEvaluateOnNewDocument): Target closed.
at D:\QUnit\SAPUI5-master\SAPUI5-master\node_modules\puppeteer\lib\Connection.js:183:56
at new Promise (<anonymous>:null:null)
at CDPSession.send (D:\QUnit\SAPUI5-master\SAPUI5-master\node_modules\puppeteer\lib\Connection.js:182:12)
at Page.evaluateOnNewDocument (D:\QUnit\SAPUI5-master\SAPUI5-master\node_modules\puppeteer\lib\Page.js:842:24)
at Page.<anonymous> (D:\QUnit\SAPUI5-master\SAPUI5-master\node_modules\puppeteer\lib\helper.js:112:23)
at D:\QUnit\SAPUI5-master\SAPUI5-master\node_modules\grunt-contrib-qunit\tasks\qunit.js:405:14
at processTicksAndRejections (internal/process/task_queues.js:85:5)
(node:4068) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4068) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Done.
Module "Sample_UI5App": skipping prune because there are no dependencies in package.json

ERROR: Failed to build module "Sample_UI5App". Not a directory: D:\QUnit\SAPUI5-master\SAPUI5--master\.\dist

0 Kudos

Hi Abdel,

After having puppeteer installed, now i am not getting any error message.

D:\QUnit\SAPUI5-master\SAPUI5-master\webapp\test\unit>grunt qunit
Running "qunit:all" (qunit) task
>> 0 tests completed with 0 failed, 0 skipped, and 0 todo.
>> 0 assertions (in 0ms), passed: 0, failed: 0
Done.

But none of the test cases are being read.

PFA the test cases run on browser.

qunit-run.png

Accepted Solutions (0)

Answers (0)