Giter Club home page Giter Club logo

vbsunit's Introduction

VBSUnit

Description

Unit Test for VBScript.

Usage

  1. create class file

    Hoge.class

    Class Hoge
      Public Function Plus(a, b)
        Plus = a + b
      End Function
    
      Public Function Minus(a, b)
        Minus = a - b
      End Function
    
      Public Function chainCharacter(a, b)
        chainCharacter = a & b
      End Function
    End Class
    
  2. create test class file

    test.Hoge.class

    Class testHoge
      Public unit
      Public obj
    
      Public Function testPlus
        unit.setName = "testPlus"
        Call unit.assertEquals(obj.Plus(2,3), 5)
        Call unit.assertEquals(obj.Plus(-2,5), 3)
        Call unit.assertEquals(obj.Plus(0,0), 0)
      End Function
    
      Public Function testMinus
        unit.setName = "testMinus"
        Call unit.assertEquals(obj.Minus(3,3), 0)
        Call unit.assertEquals(obj.Minus(100,5), 95)
      End Function
    
      Public Function testChainCharacter
        unit.setName = "testChainCharacter"
        Call unit.assertEquals(obj.chainCharacter("hoge", "fuga"), "hogefuga")
        Call unit.assertNotEquals(obj.chainCharacter(1, 1), 2)
      End Function
    
      Private Sub Class_Initialize
        Set unit = new VBSUnit
        Set obj  = new Hoge
      End Sub
      Private Sub Class_Terminate
        Set obj  = Nothing
        Set unit = Nothing
      End Sub
    End Class
    
  3. TestRunner

Assertions

  • assertEquals
  • assertNotEquals
  • assertTrue
  • assertFalse
  • assertNull
  • assertNotNull
  • assertEmpty
  • assertNotEmpty
  • assertContains
  • assertNotContains
  • assertStringStartsWith
  • assertStringStartsNotWith
  • assertStringEndsWith
  • assertStringEndsNotWith
  • assertInternalType
  • assertNotInternalType
  • assertStringEqualsFile
  • assertStringNotEqualsFile
  • assertFileEquals
  • assertFileNotEquals
  • assertFileExists
  • assertFileNotExists
  • assertGreaterThan
  • assertGreaterThanOrEqual
  • assertLessThan
  • assertLessThanOrEqual
  • assertCount
  • assertNotCount

TestRunner

Usage

TestRunner.wsf /d:DIRECTORY_PATH [/o:OUTPUT_LOGFILE]
TestRunner.wsf /?

  /?                  Print this help.
  /d:DIRECTORY_PATH   Target Directory Path
  /o:OUTPUT_LOGFILE   Output directory. Default Current directory.

Example

cscript //nologo TestRunner.wsf /d:C:\VBS
cscript //nologo TestRunner.wsf /d:C:\VBS
cscript //nologo TestRunner.wsf /d:C:\VBS /o:C:\VBS\log

vbsunit's People

Contributors

miyamiya avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.