mardi 29 décembre 2015

JavaScript and AngularJS testing - Karma, Jasmine, karma-jasmine, etc

I'm preparing some curriculum for students at a bootcamp, and this is my first exposure to testing in general, let alone testing in Angular. I've been researching a lot of stuff, but thought I could get some definitive answers from the community:

I'm still a little hazy on how Karma and Jasmine work together. I understand that Karma is a test runner and Jasmine is the framework that includes assertions, describe blocks, etc. But what is the best/preferred way to install these to start including testing in an Angular app? I've done npm install --save-dev karma, run karma init and set all the settings, and downloaded Jasmine from their releases page, but I'm not exactly sure how to integrate these into a new or existing Angular application. The Jasmine Standalone seems to have its own organization that requires you to move all your source files to their src folder, but that seems ridiculous unless you're just testing vanilla JavaScript (which I'm guessing is what the Jasmine standalone version is for?)

I also saw in the Angular docs on testing a reference to karma-jasmine, which I'm not 100% sure how that plays in with karma and jasmine as separate entities.

Any guidance or help for a testing beginner would be greatly appreciated. I've spent hours researching and am still a bit confused on all of it. Sorry if these questions are dumb, I'm really new to the whole concept.

Thanks in advance for your help!

Aucun commentaire:

Enregistrer un commentaire