MeirionHughes / aurelia-cli-electron-app

A basic example of aurelia (cli) running in electron with vscode breakpoint debugging
31 stars 3 forks source link

Add Testing #4

Closed MeirionHughes closed 7 years ago

MeirionHughes commented 8 years ago

http://electron.atom.io/spectron/

javiercbk commented 7 years ago

I'm creating an electron app using this project as skeleton. I can help you by configuring a test runner and writing some tests.

Since you are quite acquainted with aurelia, I was wondering:

MeirionHughes commented 7 years ago

Adding in what you get by default by the aurelia-cli would probably be the best first step. Location wise, I'd prefer a seperate /spec folder. I was hoping to have the spec tests operate on the end-product (electron), but that might not be feasible.

To be fair, I've not done spec tests in the browser yet, only stuff with server-side (yasmine); so I'll defer to you if you'd like to add something.

javiercbk commented 7 years ago

A quick glance to spectron seems to indicate that it's the "blackest boxed testing" ever 😬 , meaning the app needs to be packaged in order for test to be executed. I'm going to write some jasmine white box tests, only for "tutorial" purposes, but any class that uses electron's API might not be easily testable (electron object should be mocked). To execute spectron's test, a script will be execute through npm (configured in package.json) that will package, run the test and may delete the packaged app later.

This way, the application the developer will have a template to write white box test, and black box tests.

MeirionHughes commented 7 years ago

Okay fair enough; testing the app components alone should be good enough.

javiercbk commented 7 years ago

I've pushed the unit testing structure with a working unit test; still lacking spectron's test nor used any class that imports electron.

I will be working on those two from now on.