Testing Powershell code with Tomty framework.

melezhik profile image Alexey Melezhik Updated on ・1 min read

There is more then one way to test it ...

How to test Powershell modules using Perl6 and Tomty

Welcome Tomty

Tomty is a Sparrow6 based testing framework, written in Perl6. We use it to write tests.


zef install Tomty


Write Powershell module


function Hello {


  Write-Host Hello $name

Write wrapper

mkdir -p .tomty/tasks/test-hello


Import-Module hello
$name = config 'name'
Hello -name $name


generator: print "Hello ".( config()->{name} )

Write test

tomty --edit test-hello

task-run ".tomty/tasks/test-hello", %( name => "Sparrow6" )

Run test

PSModulePath=$PWD/modules tomty test-hello

02:47:26 07/27/2019 [repository] index updated from file:///home/melezhik/repo/api/v1/index
02:47:26 07/27/2019 [.tom/tasks/test-hello] Hello Sparrow6
[task check] stdout match <Hello Sparrow6> True

Run more tests

Once you have more tests, you run them all:

tomty --all

See Tomty documentation for other options.

Thank you for reading. I'd appreciate comments.

Posted on by:

melezhik profile

Alexey Melezhik


Sparrow6 - Raku Automation Framework


markdown guide