Giter Site home page Giter Site logo

learn-karma's Introduction

Dive into Karma JavaScript Test Runner


Dilbert Real Data

Not only can data be "real" but so can testing (in "real" browsers)!

What is Karma?

If you've never heard of Karma, prepare to have your mind blown! :-)

Official Description: Karma is a [test automation] tool that spawns a web server and executes source code against test code for each of the browsers connected. The results for each browser are examined and displayed via the command line so developers can see which browsers and tests passed or failed.

In other words, you can automatically test all your front-end code in any / all your target browsers each time you save your work.

Why is Karma Awesome?

You don't have to think about switching contexts to run your tests. Simply save the file you are working on and Karma's watcher will automatically instruct all the connected browsers to re-run the tests.

Imagine you have 10 browsers you need to test your code against: [Internet Explorer 7/8/9/10, Firefox 3.5/Latest, Chrome, Safari Mac/iOS, Opera] If the target browsers are all on the machine that is running Karma, you would simply add them to the configuration file and Karma would manage them for you.

Any browsers on machines/devices can connect to Karma over the internet and run tests simply by pointing the browser at the Karma server: http://test.acme.com:9876/ or using a service like http://localtunnel.me to make your development machine accessible outside of your network.

Once the browser is connected to Karma it will run all the tests for you on auto-pilot and respond with test results.

Get Started

If you are learning by cloning this repository

git clone https://github.com/nelsonic/learn-karma.git

then install dependencies (karma and jasmine) locally:

npm install

Otherwise, if you are going to run Karma for all your projects (because you think its awesome):

sudo npm install -g karma

As of version 0.12

sudo npm install -g karma-cli

Karama Configuration (File)

Run the Karma initilisation (wizard) to create your configuration file:

karma init

Go through each step and select the defaults. You can always change them manually in your karma.config.js file.

Once you are through the wizard, initiate Karma:

karma start karma.conf.js

This will open a browser window (what ever the default on your computer is) with the url: http://localhost:9876/

Karma Chrome Connected

I will need to come back to this tutorial later as have just been handed a ton of work that needs to be done Today! :-( if you can't wait read: http://www.tuesdaydeveloper.com/2013/06/angularjs-testing-with-karma-and-jasmine/

Notes

Useful Links

Using Karma with Travis CI

How-to Videos

Tutorials

learn-karma's People

Contributors

nkamc avatar nelsonic avatar besarthoxhaj avatar

Stargazers

Gabriel avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

guotechfin

learn-karma's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.