QUnit Tutorial
QUnit Useful Resources
Selected Reading
- QUnit - Nested Modules
- QUnit - Callbacks
- QUnit - Expect Assertions
- QUnit - Async Call
- QUnit - Only Test
- QUnit - Skip Test
- QUnit - Execution Procedure
- QUnit - Using Assertions
- QUnit - API
- QUnit - Basic Usage
- QUnit - Environment Setup
- QUnit - Overview
- QUnit - Home
QUnit Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
QUnit - Skip Test
QUnit - Skip Test
有时,我们的法典没有准备就绪,而为测试该方法/编码而撰写的测试案例在运行时失败。 QUnit.skip> 在这方面提供帮助。 使用天空法书写的测试方法将不予执行。 让我们看到天空法在行动。
<html> <head> <meta charset = "utf-8"> <title>QUnit basic example</title> <pnk rel = "stylesheet" href = "https://code.jquery.com/qunit/qunit-1.22.0.css"> <script src = "https://code.jquery.com/qunit/qunit-1.22.0.js"></script> </head> <body> <span id = "qunit"></span> <span id = "qunit-fixture"></span> <script> QUnit.module( "Module A", { beforeEach: function( assert ) { assert.ok( true, "before test case" ); }, afterEach: function( assert ) { assert.ok( true, "after test case" ); } }); QUnit.test( "test case 1", function( assert ) { assert.ok( true, "Module A: in test case 1" ); }); QUnit.skip( "test case 2", function( assert ) { assert.ok( true, "Module A: in test case 2" ); }); QUnit.module( "Module B" ); QUnit.test( "test case 1", function( assert ) { assert.ok( true, "Module B: in test case 1" ); }); QUnit.skip( "test case 2", function( assert ) { assert.ok( true, "Module B: in test case 2" ); }); </script> </body> </html>
Verify the Output
你应当看到以下结果:
Advertisements