1

We have an OpenUI5 app with QUnit tests. We tried to automate the tests with grunt-contrib-qunit, but when grunt-contrib-qunit starts our qunittests.html file in phantomjs, it gives the following error:

>>  Error: found in negative cache: 'sap/ui/core/Core.js' from TODO???/sap/ui/core/Core: Error: found in negative cache: 'sap/ui/core/Component.js' from TODO???/sap/ui/core/Component: Error: found in nega...

The same file with the QUnit tests works fine in chrome.

In order to sort out that our environment causes the issue, i did the following:

I created a Gruntfile.js with nothing else then grunt-php and grunt-contrib-qunit. Then i downloaded the code from OpenUI5 Walkthrough Step 35. I started the Walkthrough app and setup grunt-contrib-qunit like this:

qunit: {
  all: {
    options: {
      urls: [
        'http://localhost:1337/test/integration/opaTests.qunit.html'
      ]
    }
  }
},

Same issue. "Negative cache".


We tested it with other grunt-implementations of qunit, with karma-qunit, CasperJS and others.

DerZyklop
  • 3,672
  • 2
  • 19
  • 27

1 Answers1

2

i faced the same problem when trying to automatically test ui5 apps. I'm not enterily sure what caused this problem but it seems related to the phantomjs version (1.9.15 at the time of writing) used by grunt-contrib-qunit. So i settled for the following DIY workaround:

First download phantomjs 2.0 and install it manually, meaning create an alias, or put it in your path. Phantomjs includes a bunch of really helpful examples in their download, one of them being run-qunit.js. If you copy that in your project root, you can use the command (open your command prompt) phantomjs run-qunit.js http://localhost:1337/test/integration/opaTests.qunit.html to run your test. Please note, that you need to start a development server before doing so, since you need to have an url to test. I also needed to increase the default timeout in run-qunit.js a fair bit, the OPA5 tests are taking a long while. Just experiment with this number.

And with the help of grunt-shell you can integrate this command in your grunt workflow. I created a grunt testunit task for my qunit tests and a separate grunt testintegration task for my OPA5 integration tests.

Hope that helps, and please ask if you face any problems with this setup. It did work for me!

Hint for future readers: This workaround may not be necessary when grunt-contrib-qunit uses phantomjs 2.0.0.

kriswep
  • 21
  • 3