Using Pester tags in test logic

Welcome Forums Pester Using Pester tags in test logic

Viewing 1 reply thread
  • Author
    • #160851
      Topics: 8
      Replies: 10
      Points: 67
      Rank: Member

      Is it possible to use Pester tags in logic?  For example, I have the following Describe block:

      Since I have two separate instances of VMware vCenter, I have to have two separate Describe blocks (using different tag arrays).  What I would like to be able to do is use a Switch statement based on the tags.  That would allow me to connect to either one or both vCenter instances in one Describe block.

    • #161949
      Topics: 0
      Replies: 28
      Points: -7
      Rank: Member

      Not possible in v4, might be possible in v5 in the future once the metadata are available to the test itself. Then you might be able to so something like `switch ($test.root.tags[0])` but that is far in the future. Theoretially you can reach into the Pester internal state and find the tag (not sure right now where it is stored) and do the same thing, but that would depend on the internal state a lot, and would not be supported or reliable.

Viewing 1 reply thread
  • The topic ‘Using Pester tags in test logic’ is closed to new replies.