/
QUnit - jQuery unit test framework

QUnit - jQuery unit test framework

개요

QUnit은 jQuery unit test framework.

사용이 편리하지만 출시된지 오래되서 여러 가지 단점이 많은 듯 함. (http://www.techtalkdc.com/which-javascript-test-library-should-you-use-qunit-vs-jasmine-vs-mocha/)


간단한 예제

설치

npm install -g qunitjs


예제용 html 파일 생성

qunit-sample.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>QUnit Example</title>
  <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.3.2.css">
</head>
<body>
  <div id="qunit"></div>
  <div id="qunit-fixture"></div>
  <script src="https://code.jquery.com/qunit/qunit-2.3.2.js"></script>
  <script src="tests.js"></script>
</body>
</html>


tests.js 생성

tests.js
QUnit.test( "hello test", function( assert ) {
  assert.ok( 1 == "1", "Passed!" );
});


cmd 에서 test 실행

qunit 'tests/*-test.js'


또는 브라우저에서 html 을 열면 아래와 같이 테스트 결과를 보여줌.

Related content

laravel test 하기
laravel test 하기
More like this
phpunit 설치 및 php 단위 테스트 하기
phpunit 설치 및 php 단위 테스트 하기
More like this
라라벨 8 model factory 로 test data 만들기
라라벨 8 model factory 로 test data 만들기
More like this
CMake 사용 예제
CMake 사용 예제
More like this
Mocha Javascript test frameword
Mocha Javascript test frameword
More like this
phpunit 단위 테스트 건너뛰기(skipping tests)
phpunit 단위 테스트 건너뛰기(skipping tests)
More like this