Uberi / Yunit

Super simple testing framework for AutoHotkey.
GNU Affero General Public License v3.0
53 stars 21 forks source link

How to see output #17

Closed dbigham closed 7 years ago

dbigham commented 7 years ago

I gave Yunit a try today but wasn't able to figure out how to see any output.

#Include <Yunit\Yunit>

class HowTestSuite
{
    class TestSkipWhitespace
    {
        Test1()
        {
            MsgBox, YO
            Yunit.Assert(1 = 2)
        }
    }
}

Tester := Yunit.Use(YunitStdout, YunitWindow)
Tester.Test(HowTestSuite)

When this runs, I see the MsgBox, but no window opens to show me any output. (Which I was expecting, since I specified YunitWindow)

I'm also unfamiliar with how to see stdout output.

mmikeww commented 7 years ago

Looks like you also need to #include Window.ahk or #include StdOut.ahk for whatever output you need. That's whats done in the example file

dbigham commented 7 years ago

You're exactly right, thanks!

That does show the window, which will get me by. Do you happen to know how one also sees the stdout?

Uberi commented 7 years ago

Hi @dbigham,

To see stdout, the script should be run in a command prompt - the output will show up below that.

Alternatively, a lot of editors will display stdout when you run the script from the editor!

mmikeww commented 7 years ago

@dbigham running the script in the cmd prompt alone doesn't seem to work for me

but this does:

https://autohotkey.com/docs/commands/FileAppend.htm

However, text sent to stdout will not appear at the command prompt it was launched from. This can be worked around by piping a script's output to another command or program. For example: "%ProgramFiles%\AutoHotkey\AutoHotkey.exe" "My Script.ahk" | more

dbigham commented 7 years ago

@mmikeww, I've confirmed what you're seeing as well. Thanks!