Coder Social home page Coder Social logo

qunitformat's Introduction

JavaScript Unit Test Infrastructure

Components required to Build JavaScript Test Suite

  1. PhantomJS - Headless Browser (To connect Qunit with CL)
  2. QUnit - (Unit Test framework for JavaScript)
  3. QUnit JavaScript runner (run QUnit.html from Phantomjs)

Installation

Step 1:

PhantomJS

Install PhantomJS

Step 2:

QUnit

Copy Qunit files the below website: QUnit Format

Following are the files of QUnitFormat

  • qunit-git.js
  • qunit.css
  • qunit.html
  • run-qunit.js
  • tests.js

Run

Step 3:

Creating Test Suite

Edit the tests.js file with application test cases and Modules

Step 4:

Copy the Qunit folder to the respective application test folder

Run the following command in shell

$ phantomjs run-qunit.js file://pwd/qunit.html

Output

Hariprasaths-MacBook-Pro:QUnitformat hari$ phantomjs run-qunit.js qunit.html
 -------------------------
| UNIT TEST Suite for JS  |
 -------------------------
success
TOTAL TEST AMOUNT: 2 

NOW RUNNING:  Module 1.0:TEST FUNCTIONS
NOW RUNNING:  Module 1.0:TEST FUNCTIONS > Module 1.1:Test SUB-FUNCTIONS
Log:  true Test case 1 Passed !
Log:  true Test case 2 Passed !
Finished running:  Module 1.0:TEST FUNCTIONS > Module 1.1:Test SUB-FUNCTIONS Failed/total:  0 2
Finished running:  Module 1.0:TEST FUNCTIONS Failed/total:  0 0
SUMMARY:
 Total assertions:  2  Failed:  0  Passed:  2  Runtime:  7
[object HTMLParagraphElement]
Test finished in 203ms.
2 tests completed in 7 milliseconds, with 0 failed, 0 skipped, and 0 todo.
2 assertions of 2 passed, 0 failed

qunitformat's People

Contributors

haripery avatar

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.