Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Document Additional Types for Tests #103

Open
michaeltlombardi opened this issue Mar 17, 2017 · 5 comments
Open

Document Additional Types for Tests #103

michaeltlombardi opened this issue Mar 17, 2017 · 5 comments

Comments

@michaeltlombardi
Copy link
Contributor

Currently, only three types are documented in the tests/code for types consumable by json: bool, string, and int.

Expected Behavior

The available types should support arrays of string and int and perhaps other types as well.

Current Behavior

In a test you can specify string[] as a type but this is undocumented even though it works.

Possible Solution

Decide on which types are acceptable and document them; at least document arrays.

Context

This would enable people to write better/more specific tests, especially in cases where the type should be an array of strings. This functionality already exists, it's just undocumented and people tend to assume that only documented things are possible.

Your Environment

  • Module version used: Vester 1.0.1
  • Operating System: Windows 10.0.14393
  • PowerShell version: 5.1.14393.693
@haberstrohr
Copy link
Contributor

I recently encountered a test where it would have been helpful to have a bool[] type. See #100, the two DVS tests are a result of what direction I ended up taking.

@brianbunke
Copy link
Contributor

Without ever testing it, I see no reason bool[] doesn't work, if you want to investigate updating #100. Perfectly illustrating @michaeltlombardi's point, haha

@midacts
Copy link
Contributor

midacts commented Apr 10, 2017

I think as long as you can run ($Actual -as $Type) and it works than that type will work for that test. I have been able to test with pscustomobject, array, hastable, object, etc.

Edit: Actually, you can't use pscustomobject because Compare-Object does not know what to compare unless you use -Property and specify the property to check. I need to double check, but i think (hope?) the others should work.

@midacts
Copy link
Contributor

midacts commented Apr 12, 2017

i was working on porting over the VM boot delay test. When you run this command:
(Get-VM $VMName).ExtensionData.Config.BootOptions.BootDelay.GetType()

It shows that it is a 'Int64'. The config file doesnt seem to be able to delineate between a int32 and a int64, meaning only $Type = 'int' will work. $Type = 'long' does not work.

What I had to do was type cast my $Desired so it stored it as an 'int'

@michaeltlombardi
Copy link
Contributor Author

We probably need a concept doc around this problem as discovered by @midacts - test writers need a way to figure out what types they can/can't use and considerations to keep in mind for this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants