Skip to content

The Results Structure

Jon Wagner edited this page Feb 18, 2013 · 1 revision

The Results Structure

You can programmatically get access to the test results one of two ways:

  • Invoke-Tests -Output Results
  • Test-Case -OutputRestuls

In either case, the function returns the results as a structure. You can access the following data:

  • Call - the display name of the test context, such as "Describing"
  • Name - the name of the test
  • Parent - a pointer to the parent test context
  • Group - true if the context is a group, false if it is a test case
  • Cases - an array of the inner groups or cases
  • Success - a boolean test result
  • Time - the number of seconds the test took
  • Exception - for a failed test, the exception or assertion thrown
  • Count - the number of cases in the test context (1 for a test case)
  • Passed - the number of test cases that passed
  • Failed - the number of test cases that failed

If you need the results output in a format other than NUnit, you can use this structure and format the data differently:

Invoke-Tests -Output Results | Format-SomeWayOtherThanNUnit