angular-desktop-app icon indicating copy to clipboard operation
angular-desktop-app copied to clipboard

[Feature request] Testing framework integration

Open RubenCordeiro opened this issue 11 years ago • 6 comments

I've been trying to add unit, midway and e2e testing by configuring karma with the mocha.js extension. However, I'm in a dead end, configuring karma with requirejs is proving to be quite confusing to me, specially with the existing codebase.

I've managed to extract the requirejs configuration object to a separate file in order to avoid repetition for the test setup.

Has anyone setup a test framework with this seed? I would greatly appreciate the help.

RubenCordeiro avatar Jul 22 '14 23:07 RubenCordeiro

I've been looking to setup unit and e2e tests since I got this seed started. I have a few ideas, I'll spend a few hours on this and hopefully we'll get some tests running in the next release.

jgrenon avatar Jul 23 '14 01:07 jgrenon

That's great. Here are a couple of ideas for the test setup that I've explored yesterday:

  • I think that the Karma testing environment is a perfect fit: it's very flexible and testing framework agnostic with some nice configuration options. There are two sources that have proven to be useful: http://www.yearofmoo.com/2013/01/full-spectrum-testing-with-angularjs-and-karma.html and http://karma-runner.github.io/0.8/plus/RequireJS.html.
  • All the tests should be placed in a test folder. The karma configuration file may be placed in the root of the folder (karma.conf.js), the requireJs application configuration that is now being made in src/js/main.js file should be moved to a separate file, i.e, require-config.js (there's a gist link with these suggestions down below). A test/test-main.js file that loads all the tests should reference require-config.js in order to avoid duplication.

A gist with some of the referenced files: https://gist.github.com/SynapseR/37771cd5329b8106e036

I'm still trying to integrate karma into the project. If I succeed in doing so, I'll be sure to do a pull request and contribute to this great seed. Thanks for the great work you've been doing.

RubenCordeiro avatar Jul 23 '14 14:07 RubenCordeiro

Should this work for testing components that have dependencies on node modules?

mikemilano avatar Aug 20 '14 22:08 mikemilano

This is good, but if i have lots of backend services, like rsa, database and so on, how can i test?:))) If you want to tell me: split it into backend and frontend, my answer no. I have no time for double work. But maybe this is nice idea, for fastest tests.

merqlove avatar Sep 10 '14 10:09 merqlove

not sure how the solution fits into this project, but take a look at this thread. we got karma and protractor testing node-webkit just fine. https://github.com/rogerwang/node-webkit/issues/2229

mikemilano avatar Sep 10 '14 10:09 mikemilano

@mikemilano Thanks. Good idea. I will try it now also.

merqlove avatar Sep 10 '14 10:09 merqlove