Need advice about which tool to choose?Ask the StackShare community!

Karma

824
588
+ 1
181
PhantomJS

481
420
+ 1
18
Add tool

Karma vs PhantomJS: What are the differences?

Developers describe Karma as "Spectacular Test Runner for JavaScript". Karma is not a testing framework, nor an assertion library. Karma just launches a HTTP server, and generates the test runner HTML file you probably already know from your favourite testing framework. So for testing purposes you can use pretty much anything you like. On the other hand, PhantomJS is detailed as "Scriptable Headless WebKit". PhantomJS (www.phantomjs.org) is a headless WebKit scriptable with JavaScript. It is used by hundreds of developers and dozens of organizations for web-related development workflow.

Karma and PhantomJS are primarily classified as "Browser Testing" and "Headless Browsers" tools respectively.

Some of the features offered by Karma are:

  • Test on Real Devices
  • Remote Control
  • Testing Framework Agnostic

On the other hand, PhantomJS provides the following key features:

  • Multiplatform, available on major operating systems: Windows, Mac OS X, Linux, and other Unices.
  • Fast and native implementation of web standards: DOM, CSS, JavaScript, Canvas, and SVG. No emulation!
  • Pure headless (no X11) on Linux, ideal for continuous integration systems. Also runs on Amazon EC2, Heroku, and Iron.io.

"Test Runner" is the top reason why over 56 developers like Karma, while over 12 developers mention "Scriptable web browser" as the leading cause for choosing PhantomJS.

Karma and PhantomJS are both open source tools. It seems that PhantomJS with 26.9K GitHub stars and 5.7K forks on GitHub has more adoption than Karma with 10.7K GitHub stars and 1.61K GitHub forks.

According to the StackShare community, Karma has a broader approval, being mentioned in 119 company stacks & 57 developers stacks; compared to PhantomJS, which is listed in 77 company stacks and 47 developer stacks.

Advice on Karma and PhantomJS
Ankur Loriya
Needs advice
on
PhantomJSPhantomJS
and
PuppeteerPuppeteer

I am using Node 12 for server scripting and have a function to generate PDF and send it to a browser. Currently, we are using PhantomJS to generate a PDF. Some web post shows that we can achieve PDF generation using Puppeteer. I was a bit confused. Should we move to puppeteerJS? Which one is better with NodeJS for generating PDF?

See more
Replies (2)
Recommends
PuppeteerPuppeteer

You better go with puppeteer. It is basically chrome automation tool, written in nodejs. So what you get is PDF, generated by chrome itself. I guess there is hardly better PDF generation tool for the web. Phantomjs is already more or less outdated as technology. It uses some old webkit port that's quite behind in terms of standards and features. It can be replaced with puppeteer for every single task.

See more
Recommends
PuppeteerPuppeteer

I suggest puppeteer to go for. It is simple and easy to set up. Only limitaiton is it can be used only for chrome browser and currently they are looking into expanding into FF. The next thing is Playwright which is just a scale up of Puppeteer. It supports cross browsers.

See more
Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of Karma
Pros of PhantomJS
  • 61
    Test Runner
  • 35
    Open source
  • 27
    Continuous Integration
  • 22
    Great for running tests
  • 18
    Test on Real Devices
  • 11
    Backed by google
  • 5
    Easy Debugging
  • 2
    Remote Control
  • 13
    Scriptable web browser
  • 3
    Depends on QT
  • 2
    No ECMAScript 6

Sign up to add or upvote prosMake informed product decisions

Cons of Karma
Cons of PhantomJS
  • 1
    Slow, because tests are run in a real browser
  • 1
    Requires the use of hacks to find tests dynamically
    Be the first to leave a con

    Sign up to add or upvote consMake informed product decisions

    What is Karma?

    Karma is not a testing framework, nor an assertion library. Karma just launches a HTTP server, and generates the test runner HTML file you probably already know from your favourite testing framework. So for testing purposes you can use pretty much anything you like.

    What is PhantomJS?

    PhantomJS is a headless WebKit scriptable with JavaScript. It is used by hundreds of developers and dozens of organizations for web-related development workflow.

    Need advice about which tool to choose?Ask the StackShare community!

    What companies use Karma?
    What companies use PhantomJS?
    See which teams inside your own company are using Karma or PhantomJS.
    Sign up for StackShare EnterpriseLearn More

    Sign up to get full access to all the companiesMake informed product decisions

    What tools integrate with Karma?
    What tools integrate with PhantomJS?

    Sign up to get full access to all the tool integrationsMake informed product decisions

    Blog Posts

    What are some alternatives to Karma and PhantomJS?
    Jasmine
    Jasmine is a Behavior Driven Development testing framework for JavaScript. It does not rely on browsers, DOM, or any JavaScript framework. Thus it's suited for websites, Node.js projects, or anywhere that JavaScript can run.
    Jest
    Jest provides you with multiple layers on top of Jasmine.
    Mocha
    Mocha is a feature-rich JavaScript test framework running on node.js and the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.
    Protractor
    Protractor is an end-to-end test framework for Angular and AngularJS applications. Protractor runs tests against your application running in a real browser, interacting with it as a user would.
    Selenium
    Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.
    See all alternatives