• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 軟件單元測試實踐(VB版)

    發表于:2009-03-31來源:作者:點擊數: 標簽:實踐單元軟件
    vb 有多個 單元測試 的軟件,如 VB unit,communit。此處選擇communit來作為單元測試的,原因是一、它是完全開放源碼的,二、它不僅能測試VB源代碼,還能測試標準COM組件。communit可以從sourceforge.net下載,也可以本地下載,本地版本與有兩個修改,一是修正
    vb有多個單元測試的軟件,如VBunit,communit。此處選擇communit來作為單元測試的,原因是一、它是完全開放源碼的,二、它不僅能測試VB源代碼,還能測試標準COM組件。communit可以從sourceforge.net下載,也可以本地下載,本地版本與有兩個修改,一是修正模板的安裝,原來的包沒有完全設置好,二是增加了時間的計算,能顯示測試花費的時間。

        使用,把包下載,然后解到一個目錄,運行install.exe,打開VB??梢园l現可以新建CoMunit Test Project的工程。有兩個文件frmTestRunner的form,TCTestContainer是測試類。下面我們看一下如何使用comunit。先下載測試代碼。

         這個代碼是測試二進制文件在數據庫里的存取。有關二進制代碼在數據庫里存取的技術問題,請看另一篇文章。用什么辦法來確定代碼是正確工作了呢?答案當然是單元測試。

        測試代碼很簡單,但的確很有效,它保證這段代碼是正確的工作了。

    ' COMUnit 1.1 - TestContainer Class

    Option Explicit

    ' Interface declaration
    Implements ITestContainer
    '定義一個recordset
    Dim k As New adodb.Recordset
    '定義bin類
    Dim BinTest As clsManagerBinFields
    '定義源文件名和目標文件名
    Dim SourceFile As String, DesFile As String
    ' Fixture Member Variables
    ' TODO: specify your TestContainer test fixture member variables here

    ' Return the name of the different test case methods in this test container
    Public Property Get ITestContainer_TestCaseNames() As Variant()
    ' TODO: add the names of your test methods as a parameter into the Array() function
     ITestContainer_TestCaseNames = Array("TestFields")
    End Property

    ' Run the specified test case methods in this test container
    Public Sub ITestContainer_RunTestCase(oTestCase As ITestCase, oTestResult As TestResult)
    On Error GoTo ErrorHandler
     InvokeHook Me, oTestCase.Name, INVOKE_FUNC, oTestResult
    ' CallByName Me, oTestCase.Name, VbMethod, oTestResult
    Exit Sub
     ErrorHandler:
     oTestResult.AddError Err.Number, Err.Source, Err.Description
    End Sub

    'Initialize the test fixture
    '在測試開始時自動調用
    Public Sub ITestContainer_Setup()

    ' TODO: initialize your test fixture here
    '指定源文件名,這里就指定這個文件
    SourceFile = App.Path & "\tctestcontainer.cls"
    '指定目標文件名,這里指定為當前目錄下的test
     DesFile = App.Path & "\test"

     

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>