I am working with PowerShell which doesn't seem to have an up-to-date language spec. This leaves me wondering about some edge cases. I've taken to testing my assumptions about how PowerShell's runtime behaves. Here is a concrete example:

It 'the System.Exception that is thrown is actually a ParameterBindingException.' {
    $o = New-Object psobject -Property @{a=1}
    $o.a | Should be 1
        $o | f
    catch [System.Exception]
        $threw = $true
        $_.Exception.Message | Should match 'The input object cannot be bound because it did not contain the information required to bind all mandatory parameters:  b'
        $_.CategoryInfo.Reason | Should be 'ParameterBindingException'
        $_.Exception -is [System.Management.Automation.ParameterBindingException] | Should be $true
    $threw | Should be $true

That test asserts part of PowerShell Version 2.0's quirky exception catching behavior. (Evidently PS V2 throws ParameterBindingException that can be caught as Exeception but not ParameterBindingException.)

This kind of test doesn't seem to fit any definition of "Unit Test" or "Integration Test" I have found. It tests the environment that code is executing in rather than the code itself.

I've spent some time searching for a name for this kind of testing but it seems like I'm just not using the key words. Is there a generally-accepted term whose definition matches this kind of test?

  • 1
    Despite my answering the question, I'm voting to close as primarily opinion based as there isn't a common, industry standard name for the aspect you are seeking to name.
    – user53019
    Nov 10 '15 at 16:38
  • @GlenH7 Your VTC is confusing. Wouldn't the answer simply be that there is no term. I don't see how that is any more opinion-based than any other questions under the [terminology] tag where terms happen to have generally-accepted definitions.
    – alx9r
    Nov 10 '15 at 16:40
  • 2
    Terminology based questions are a murky type of question for the site. On the one hand, there are common, well known things that can be reliably named. On the other hand, there are tons and tons of things that people think "ought to be" named, but aren't. And all of that begs the question "what problem are you really trying to solve?" Beyond idle curiousity, solving the "name that thing" problem isn't terribly useful for the community. I only wrote an answer as it was too long for a comment. See also: meta.programmers.stackexchange.com/q/6582/53019
    – user53019
    Nov 10 '15 at 16:49
  • @GlenH7 Understood.
    – alx9r
    Nov 10 '15 at 16:55

To my knowledge, there isn't a common, industry standard term for what you're asking about.

Capability based testing is probably the closest term you'll find to match what you're describing. It's very common within web development to have a run-time test that probes the capabilities of the browser and reacts accordingly.

Capability based testing is fairly orthogonal to unit or integration testing, and I would discourage conflating the two ideas. Capability based testing occurs at run-time and directs the flow of the code. Unit and integration testing is intended to measure correctness and to provide validation that code is working as expected.

Not the answer you're looking for? Browse other questions tagged or ask your own question.