웹 개발

javascript unit test - qunit

노루아부지 2019. 8. 23. 22:32

java는 junit이라는 훌륭한 테스트 모듈이 있는데

javascript도 정말 좋은 테스트 모듈이 있습니다.

 

1. 공식 홈페이지

http://qunitjs.com/

 

QUnit

QUnit: A JavaScript Unit Testing framework. What is QUnit? QUnit is a powerful, easy-to-use JavaScript unit testing framework. It's used by the jQuery, jQuery UI and jQuery Mobile projects and is capable of testing any generic JavaScript code, including it

qunitjs.com

 

2. 사용방법

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>QUnit Example</title>
		<link rel="stylesheet" href="qunit.css">
        <script>
        	test( "hello test", function() {
				ok( 1 == "1", "Passed!" );
			});
        </script>
	</head>
	<body>
		<div id="qunit"></div>
		<div id="qunit-fixture"></div>
		<script src="qunit.js"></script>
		<script src="tests.js"></script>
	</body>
</html>

 

3. 결과화면

728x90
loading