2017-01-25 1 views
2

instructions here를 사용하여 외부의 시작에 대한 오류()를 제공합니다 :실행 html로 QUnit 테스트는 테스트 환경

module('Product - Somme Condition', { 
    setup: function() { 
     $('#Markup').append('<div>...</div>'); 
    }, 
    teardown: function() { 
     $('#Markup').empty(); 
    } 
}); 

test('Given When Then', function() { 
    //.. 
}); 
:
Error: Error: Error: Called start() outside of a test context while already started 
at start in https://cdnjs.cloudflare.com/ajax/libs/qunit/1.18.0/qunit.min.js (line 11) 
at startQUnit (line 12) 
at onPageLoaded (line 16) 

그리고 테스트

처럼 포맷 ,

test step
은 (I 한번 작동 .HTML *하기를 변경할 것이다

<!DOCTYPE html> 
<html> 
<head> 
    <title>Product Test Runner</title> 
    <meta charset="utf-8" /> 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/qunit/1.18.0/qunit.min.css" /> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/qunit/1.18.0/qunit.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/blanket.js/1.1.4/blanket.min.js"></script> 
    <script src="../../BuildFiles/someDependency.js"></script> 
    <script src="../../BuildFiles/product.js"></script> 
    <script src="../Tests/Product/ProductTest.js"></script> 
</head> 
<body> 
    <form> 
     <div id="qunit"></div> 
     <div id="qunit-fixture"></div> 
     <div id="Markup"></div> 
    </form> 
</body> 
</html> 

단계는 비주얼 스튜디오 테스트 단계로 설정되어 다음 HTML 러너와 3,691,363,210

들은 동일한 설정되고 하나의 파일을 테스트하는 것이 더 쉽고 모든 파일이 동일하게 작동하고 위와 같이 구성됩니다.)

테스트는 "통과"로 로그에 나타나지만 빌드 단계는 결정적이지 않습니다. 이 초록색을 어떻게 만들 수 있습니까?

build steps

- 편집

example QUnit test,

사용

<!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.2.1.css"> 
</head> 
<body> 
    <div id="qunit"></div> 
    <div id="qunit-fixture"></div> 
    <script src="https://code.jquery.com/qunit/qunit-2.2.1.js"></script> 
    <script src="tests.js"></script> 
</body> 
</html> 

그리고 호출하는 뻔뻔 스러움을 통해 :

,
chutzpah.console.exe C:\Dev_Scratch\testRunner.html 

오류 출력은 다음과 같습니다 더이 상태를 변경할 수있는 빌드 정의의 옵션 내장 없다

Chutzpah console test runner (64-bit .NET 4.0.30319.42000) Version 4.3.4.0 Copyright (C) 2016 Matthew Manela (http://matthewmanela.com).

Error: Error: Called start() while test already started running at start in https://code.jquery.com/qunit/qunit-2.2.1.js (line 2550) at startQUnit (line 12) at onPageLoaded (line 16) (line 18) While Running:C:\Dev_Scratch\testRunner.html

Error: Error: Called start() while test already started running While Running:C:\Dev_Scratch\testRunner.html

File: C:\Dev_Scratch\testRunner.html 1 total, 0 failed, took 0.01 seconds

Tests complete: 1 === 1 total, 0 failed, took 2.52 seconds ===

+1

chutzpah.console.exe 응용 프로그램을 사용하여 로컬로 실행할 때 작동합니까? –

+0

@utematta chutzpah.console.exe에서 실행할 때 @MatthewManela 같은 오류가 발생합니다. 브라우저에서 html 파일을 여는 것은 괜찮습니다. – NikolaiDante

답변

0

.

✓가있는 노란색은 부분적으로 전달됩니다.

빌드 상태를 녹색으로 변경하려는 경우. 이 문제를 해결하기 위해 배치 파일을 사용하여 테스트를 실행할 수 있습니다. 그렇다면 Redirecting Error Messages from Command Prompt: STDERR/STDOUT이 필요합니다. 이것은 트릭을 할 것입니다.

+0

응답 해 주셔서 감사합니다. 합리적인 대안처럼 들리지만, 우선 QUnit 테스트 또는 chutzpah를 구성하여 처음부터 오류를 던지지 않도록하십시오. – NikolaiDante