Skip to content

[Feature Request] Ability to run remote tests and grouping of tests #6

Description

@rchaganti

I was working on a similar project as poshspec internally but did not make much progress. Now that I see this project, I don't think I need to invest in creating a new framework altogether. However, here is something I was trying to achieve in my code.

node host1, host2, host3 {
    test1 param1 { should be value1 }
    test2 param2 { should be value2 }
    test3 param3 { should be value3 }
}

The Node block let's me specify a set of remote systems where my the tests must be executed. I was targeting PS Remoting to help me execute the test remotely and assert the result locally. For this, I started modifying Remotely and added support for specifying node names as a part of DSL and supply a credential hash when needed. Here is how the tests are written today.

$CredHash = @{
    'VM1' = (Get-Credential)
}

Describe "Add-Numbers" {
    It "adds positive numbers on two remote systems" {
        Remotely 'VM1','VM2' { 2 + 3 } | Should Be 5
    }

    It "gets verbose message" {
        $sum = Remotely 'VM1','VM2' { Write-Verbose -Verbose "Test Message" }
        $sum.GetVerbose() | Should Be "Test Message"
    }

    It "can pass parameters to remote block with different credentials" {
        $num = 10
        $process = Remotely 'VM1' { param($number) $number + 1 } -ArgumentList $num -CredentialHash $CredHash
        $process | Should Be 11
    }
}

However, this is still not sufficient as I don't have the remote system context in the assert result from Should. Here is where I was thinking that I will put a higher level wrapper on this and create something like what I proposed in my first example.

At the end of all this, there are two goals:

  • Create the ability to execute tests remotely

  • In the test output, I should be able to group the test results based on where they ran

    I am continuing to work on this model and I will try to add the feature to poshspec. I am posting this request here to see if any others have any ideas on how to make this better.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions