How to unit-test and e2e-test atom-shell applications?


#1

Does anyone use some unit-testing or e2e-testing tool for their app?


How to test an Electron app?
#2

I am also looking for something like this.


#3

When I’ve experimented with atom-shell, I just use Jasmine like in Atom itself.


How to test an Electron app?
#4

I looked at the spec folder of atom-shell to get the insipiration. Basically you create another atom-shell app in which all your testing actually happens.


#5

hey @ducky427,
can you elaborate a bit more on how you managed to get your testing environment up and running?


#6

There is a documentation using WebDriver.

http://electron.atom.io/docs/v0.30.0/tutorial/using-selenium-and-webdriver/


#7

Hi everyone,

I would like to know if someone knows a good way to unit-test and/or e2e-test an Electron app. Is there a tutorial somewhere?
I refered to this topic but I didn’t find it very helpful.

Thanks!


#8

There’s https://github.com/jprichardson/electron-mocha that entices me but honestly there’s so little documentation about how to use it. There’s very few tutorials on writing mocha tests that apply themselves to electron and a beginner like me is having a lot of trouble getting started with testing electron due to the unique framework.


#9

For anyone interested, I have documented about my approach here: http://blogs.nnn.ninja.np/fb-messenger/2015/12/05/Learning-js-technologies-part22/

tl;dr…
Just grab the code from this url: https://github.com/nripendra/fb-messenger/tree/develop/tests

You’ll have to change runner/index.html file to suit your need… I have all the tests in single file, so doing just

jasmine.addSpecFile(path.resolve("./tests/out/tests/specs/login.spec.js"));

works for me.

For most of scenario people may want to use something that can grab desired files using glob patterns.

NB:
Since this post is allowing just 2 links, I’m not linking the original author, but you’ll find the link in my post. The original project to use this approach is rhysd/Shiba in github.


#10

Maybe my module for testing with tape will help: taped-electron


#11

@mnichols I have just published somewhat same module for testing Electron app, with console reporter: electron-tap