2011-04-08 3 views

답변

3

또한 ScriptUnit이고 "vbscript unittest"로 google을 사용하면 an ancient posting of mine (별로 성공하지 못함)을 찾을 수 있습니다. 나는 여전히 주제에 관심이 있고 당신에게 적합한 방식으로 협조하고 싶습니다.

+0

사실 나는 그 게시물을 찾았지만 X1 URL (실명 ...)을 놓쳤습니다. 감사! – AmonPL

+0

몇 가지 질문 : 1. 어떻게 어설트를 수행 할 수 있었습니까? 나는 WSH 버전 5.8을 가지고 있으며 "Classd not registerd"오류가 발생합니다. 2. 테스트중인 vbs 파일을 테스트 파일에 어떻게 포함 시켰습니까? (ReadAll, Execute?) – AmonPL

+0

죄송합니다. 귀하가 어떤 내용을 추천하는지 잘 모르겠습니다. 내 단위 테스트 '시스템'은 Perl 접근 방식 (클래스가 필요하지 않음)과 비슷하지만 적절한 값에 대한 비교를 호출하기 만하면됩니다. 모듈 '시스템'은 ReadAll과 ExecuteGlobal에 의해 구현됩니다. 행 번호와 구문 설탕을 얻으려면 사전 처리 단계가 필요합니다. –

2

난 그냥 초경량 VBScript 기반 단위 테스트 프레임 워크를 포함하는 GitHub 레포를 밀었습니다. 지금 만 AssertEqual 및 AssertErrorRaised은 가지고 있지만, 그조차 필요의 경우는 더 추가 할 슈퍼 쉬운 것입니다 : 여기

https://github.com/koswald/VBScriptspec file

With CreateObject("includer") 
    Execute(.read("VBSValidator")) 
    Execute(.read("TestingFramework")) 
End With 

Dim val : Set val = New VBSValidator 'Class Under Test 

With New TestingFramework 

    .describe "VBSValidator class" 

    .it "should return True when IsBoolean is given a True" 

     .AssertEqual val.IsBoolean(True), True 

End With 

에서 조각입니다 그리고 여기 샘플 test launcher

입니다
Main 
Sub Main 
    With CreateObject("includer") 
     ExecuteGlobal(.read("VBSTestRunner")) 
    End With 
    Dim testRunner : Set testRunner = New VBSTestRunner 
    With WScript.Arguments 
     If .Count Then 

      'if it is desired to run just a single test file, pass it in on the 
      'command line, using a relative path, relative to the spec folder 

      testRunner.SetSpecFile .item(0) 
     End If 
    End With 

    'specify the folder containing the tests; path is relative to this script 

    testRunner.SetSpecFolder "../spec" 

    'run the tests 

    testRunner.Run 
End Sub 
+1

Karl, thx. 여기에 유용한 스 니펫을 잘라내어 붙여 넣으시겠습니까? [답변은 다른성에 있습니다 : 대답이 대답이 아닐 때] (http://meta.stackexchange.com/questions/225370) – Drew

+0

감사합니다. 덧글 Drew. 나는 적절하게 변화를 만들었다. –

+0

Karl 공유를위한 Thx : p – Drew

관련 문제