Skip to content
Super simple testing framework for AutoHotkey.
Branch: master
Clone or download
Pull request Compare This branch is 17 commits ahead of Uberi:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
runner
.editorconfig
.gitignore
JUnit.ahk
LICENSE.txt
OutputDebug.ahk
README.md
Stdout.ahk
Window.ahk
Yunit.ahk
runner.ps1

README.md

Yunit

Super simple unit testing framework for AutoHotkey.

Basic Example

#Include ..\Yunit.ahk
#Include ..\StdOut.ahk

Yunit.Use(YunitPorcelainStdOut).Test(EqualityTests, OtherTests)

class EqualityTests
{
    Begin()
    {
        ; Executes before each test
        this.expected := 123
    }

    IsEqual()
    {
        actual := 123
        Yunit.that(this.expected, actual, "extra fail msg")
    }

    End()
    {
        ; Executes after each test
        this.Delete("expected")
    }
}

; Nesting is possible:
class OtherTests
{
    class InnerTests
    {
    }
}

Running Tests

Run a testsuite:

cd doc
AutoHotkey.exe OtherExampleTests.ahk | more

Use the runner:

.\runner.ps1 -path .\doc -file "*Tests.ahk" -Monitor $false

runner.ps1 output

Output Modules

Modules that come with Yunit:

  • Stdout.ahk: YunitPorcelainStdOut = Format understood by runner.ps1
  • JUnit.ahk: YunitJUnit = JUnit Xml output
  • OutputDebug.ahk: YunitOutputDebug
  • Stdout.ahk: YunitStdOut
  • Window.ahk: YunitWindow = Simple GUI

Build your own

Stop running on first failed test:

class EarlyExit
{
    Update(Category, Test, Result)
    {
        if IsObject(Result)
        {
            ExitApp 1
        }
    }
}

Usage: Yunit.Use(YunitPorcelainStdOut, EarlyExit).Test(TestSuites)

Docs

See doc/Main.md

Branch Description

  • Branch master covers usage of YUnit in AutoHotkey from 1.1.x up to 2.0.a77
  • Branch v2 covers usage of Yunit in AutoHotkey from 2.0.a78 (where incompatible changes in GUI-interface where introduced)

License

Copyright 2012 Anthony Zhang (Uberi) and Joe Taber (infogulch).

You can’t perform that action at this time.