Getting Started with Qunit

Source: Internet
Author: User

Recently, I like using JUnit to Tdd,js on Java as well. I felt jquery was good before, so using Qunit is probably the most famous.

First, log in to the official website http://qunitjs.com/, download two files:

  • Qunit-1.15.0.js
  • Qunit-1.15.0.css

    In fact, the qunit framework of these two things.

    Then write an HTML and a JS in the reference Getting Started:

    <!DOCTYPE html><html><head> <meta charset="utf-8"> <title>QUnit Example</title> <link rel="stylesheet" href="//code.jquery.com/qunit/qunit-1.15.0.css"></head><body> <div id="qunit"></div> <div id="qunit-fixture"></div> <script src="//code.jquery.com/qunit/qunit-1.15.0.js"></script> <script src="tests.js"></script></body></html>

    Note that it is better to change the path to

    <linkrel="stylesheet" href="Qunit-1.15.0.css">

    <scriptsrc="Qunit-1.15.0.js"></Script >

    Otherwise, it is possible to fail.

    Then create a new tests.js, note that the name is not mistaken, I wrote for Test.js for a few minutes

    "hello test"function( assert ) {  1"1""Passed!" );});

    Then you can see the test page:

  • Getting Started with Qunit

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.