DexterPOSH / PSRemotely

Remote operations validation framework, exposes a DSL to wrap existing Pester/PoshSpec based validation tests.
http://psremotely.readthedocs.io/en/latest/
MIT License
46 stars 7 forks source link

PSRemotely - Issue with parsing Describe blocks #27

Closed DexterPOSH closed 7 years ago

DexterPOSH commented 7 years ago

While wrapping the Pester tests in PSRemotely, the test name needs to be at the first position mentioned like below :-

PSRemotely {
    Node AD {
        Describe 'testIPconfig' {
             # Tests here
        }
    }
}

At the moment for specifying tags, one has to use the below :-

PSRemotely {
    Node AD {
        Describe 'testIPconfig' -Tag DummyTag {
             # Tests here
        }
    }
}

If anything else then above is specified then parsing the Describe block for the test name fails. For example below fails :-

PSRemotely {
    Node AD {
        Describe -name 'testIPconfig'  {
             # Tests here
        }
    }
}

Below format also fails :-

PSRemotely {
    Node AD {
        Describe -Tag 'dummytag' 'testIPconfig' {
             # Tests here
        }
    }
}
DexterPOSH commented 7 years ago

Using AST for this seems to be quite tricky , so have below approaches :-

DexterPOSH commented 7 years ago

Went ahead with creating a proxy function approach for this. But found a limitation that when creating proxy functions the parameters are not completely copied from the original function (at least the default values for the parameters is missed). So had to explicitly add more validation once the parameters were resolved.

Take a look at the unit and integration tests in place for this. This is the first time I practically wrote tests before writing the code #TDD FTW!