{"id":12192,"date":"2016-06-13T06:00:00","date_gmt":"2016-06-13T13:00:00","guid":{"rendered":"https:\/\/www.sapien.com\/blog\/?p=12192"},"modified":"2016-07-13T11:33:38","modified_gmt":"2016-07-13T18:33:38","slug":"how-to-run-a-pester-test","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/","title":{"rendered":"How to Run a Pester Test"},"content":{"rendered":"<p>Applies to: Pester 3.4.0<\/p>\n<p>When you crack open the Pester module, you find the <strong>New-Fixture<\/strong> function, which creates a script and test file pair, and the <strong>Invoke-Pester<\/strong> function, which runs Pester tests.<\/p>\n<p>But New-Fixture is not the only way to create a Pester test and Invoke-Pester is not the only way to run a test.<\/p>\n<p>In this blog post, we&#8217;ll discuss the different ways to run a Pester test, including, but not limited to, the Invoke-Pester function. In the next post, I&#8217;ll rave about the cool parameters of Invoke-Pester.<\/p>\n<blockquote><p>\nSee the posts in this Pester series:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/\" target=\"_new\">How to Run a Pester Test<\/a><\/li>\n<li><a href=\"https:\/\/www.sapien.com\/blog\/2016\/06\/15\/invoke-pester-run-selected-tests\/\" target=\"_new\">Invoke-Pester: Running Selected Tests<\/a><\/li>\n<li><a href=\"https:\/\/www.sapien.com\/blog\/2016\/06\/17\/how-to-pass-parameters-to-a-pester-test-script\/\" target=\"_new\">How to Pass Parameters to a Pester Test Script<\/a><\/li>\n<li><a href=\"https:\/\/www.sapien.com\/blog\/2016\/06\/24\/testing-pester-code-coverage\/\" target=\"_new\">Testing Pester Code Coverage<\/a><\/li>\n<\/ul>\n<\/blockquote>\n<h1>Where can I put Pester tests?<\/h1>\n<p>To decide where to put your Pester tests, consider how you plan to run them and when you want them to be available.<\/p>\n<p><b>The best place to put a Pester test is in a *.Tests.ps1 file. <\/b>A .Tests.ps1 script is immediately recognizable as a file of Pester tests. This is critical in a shared project, like an open source module, where collaborators might need to search for or identify tests, or verify that tests exist.<\/p>\n<p>Also, by default, Invoke-Pester runs all *.Tests.ps1 files. When you make it easy for people to run your tests, they&#8217;re more likely to run them.<\/p>\n<p>However, syntactically, a Pester test is a <b>Describe<\/b> block and its valid contents, including at least one <b>It<\/b> block that encloses a test. A <b>.Tests.ps1<\/b> script is the best place to put Pester tests, but it&#8217;s not the only valid place.<\/p>\n<p>You can put the Pester test in any one of these places (and probably in a few others):<\/p>\n<ul>\n<li><b>Tests script<\/b>: The best place to put Pester tests is in a Tests script, that is, a *<b>.Tests.ps1<\/b> file.<\/li>\n<li><b>Script<\/b>: You can place Pester tests in a standard Windows PowerShell script (.ps1), including the script that contains the code that is being tested.<\/li>\n<li><b>Command<\/b>: You can place Pester tests in a cmdlet, function, or workflow. Be sure that the code that is being tested is in a scope that the test can access.<\/li>\n<li><b>Module<\/b>: You can place Pester tests in a *.Tests.ps1, a different .ps1, or .psm1 file in a module directory. Again, be sure that the command that is being tested is available to the test, including being in an accessible scope. To mock or test commands in a function that are not exported, enclose the tests in an <b>InModuleScope<\/b> script block. To export a test into a session, place it in an exported cmdlet, function, or workflow.<\/li>\n<\/ul>\n<h1>How can I run Pester tests?<\/h1>\n<p>The standard way to run Pester tests is by using the <b>Invoke-Pester<\/b> function. Invoke-Pester is a fantastic tool &#8212; a little dynamo in your toolbox. When you use Invoke-Pester, you get it&#8217;s terrific output and parameters.<\/p>\n<p>But it&#8217;s not the only way to run a Pester test.<\/p>\n<p>A Pester test consists of valid Windows PowerShell commands. We don&#8217;t think of it as such, but Describe is a Windows PowerShell function that the Pester module exports. Its contents, including Context and It blocks and Should assertions are all valid Windows PowerShell commands.<\/p>\n<p>Therefore, you can run Pester tests&#8230;<\/p>\n<ul>\n<li><strong>At the command line<\/strong><br \/>\nYou can run a Pester test at the command line in the console. Notice that you don&#8217;t get the little test summary that Invoke-Pester adds, but it&#8217;s otherwise the same.<a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2016\/06\/clip_image002.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"clip_image002\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2016\/06\/clip_image002_thumb.jpg\" alt=\"clip_image002\" width=\"540\" height=\"120\" border=\"0\" \/><\/a><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2016\/06\/clip_image004.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"clip_image004\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2016\/06\/clip_image004_thumb.jpg\" alt=\"clip_image004\" width=\"548\" height=\"158\" border=\"0\" \/><\/a><\/li>\n<li><strong>By running a script<\/strong>When you run a script that contains a Pester test, the Pester test runs. So, any way that you can run a script runs a Pester test, including typing the path at the command line or running in your favorite script editor.In PowerShell Studio, you can run and debug Pester tests. I like to use the Run in Console command so I can see the familiar purple, green, and red colors of the test results.\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2016\/06\/clip_image006.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"clip_image006\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2016\/06\/clip_image006_thumb.jpg\" alt=\"clip_image006\" width=\"646\" height=\"424\" border=\"0\" \/><\/a><\/li>\n<li><strong>By using Invoke-Pester<\/strong><br \/>\nInvoke-Pester is a terrific function. You don&#8217;t need to use it to run scripts, but once you understand it fully, you&#8217;ll use it more often and enjoy its features.By default, <b>Invoke-Pester<\/b> runs all Pester tests in all .Tests.ps1 files in the local directory and all subdirectories recursively.It&#8217;s a brilliant default because it works well for continuous integration and it doesn&#8217;t duplicate other commands that require more complex command syntax to run recursively.<\/p>\n<p>But, the power of Invoke-Pester is in it&#8217;s knockout parameters. I&#8217;ll save those for a separate post.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Learning Pester? Check out <a title=\"Real-World Test-Driven Development with Pester\" href=\"https:\/\/www.youtube.com\/watch?v=gssAtCeMOoo\" target=\"_blank\">Real-World Test-Driven Development with Pester<\/a>. The code and slides are in Github at <a href=\"https:\/\/github.com\/juneb\/PesterTDD\">https:\/\/github.com\/juneb\/PesterTDD<\/a>.<\/p>\n<p><em>June Blender is a technology evangelist at SAPIEN Technologies, Inc. and a Windows PowerShell MVP. You can reach her at <\/em><a href=\"mailto:juneb@sapien.com\"><em>juneb@sapien.com <\/em><\/a><em>or follow her on Twitter at <\/em><a href=\"https:\/\/www.twitter.com\/juneb_get_help\"><em>@juneb_get_help<\/em><\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Applies to: Pester 3.4.0 When you crack open the Pester module, you find the New-Fixture function, which creates a script and test file pair, and the Invoke-Pester function, which runs Pester tests. But New-Fixture is not the only way to create a Pester test and Invoke-Pester is not the only way to run a test. [&hellip;]<\/p>\n","protected":false},"author":31,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1122,1119,1121,1120,25],"tags":[1125,1127,934,1123,28,1124,622,1126],"class_list":["post-12192","post","type-post","status-publish","format-standard","hentry","category-behavior-driven-development-bdd","category-pester","category-test-driven-development","category-testing","category-windows-powershell","tag-bdd","tag-invoke-pester","tag-juneb","tag-pester","tag-powershell","tag-tdd","tag-testing","tag-unit-test"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Applies to: Pester 3.4.0 When you crack open the Pester module, you find the New-Fixture function, which creates a script and test file pair, and the Invoke-Pester function, which runs Pester tests. But New-Fixture is not the only way to create a Pester test and Invoke-Pester is not the only way to run a test.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"June Blender\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"DEV SAPIEN Blog - Tools for IT Success\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"How to Run a Pester Test - DEV SAPIEN Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Applies to: Pester 3.4.0 When you crack open the Pester module, you find the New-Fixture function, which creates a script and test file pair, and the Invoke-Pester function, which runs Pester tests. But New-Fixture is not the only way to create a Pester test and Invoke-Pester is not the only way to run a test.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2016-06-13T13:00:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2016-07-13T18:33:38+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How to Run a Pester Test - DEV SAPIEN Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Applies to: Pester 3.4.0 When you crack open the Pester module, you find the New-Fixture function, which creates a script and test file pair, and the Invoke-Pester function, which runs Pester tests. But New-Fixture is not the only way to create a Pester test and Invoke-Pester is not the only way to run a test.\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2016\\\/06\\\/13\\\/how-to-run-a-pester-test\\\/#blogposting\",\"name\":\"How to Run a Pester Test - DEV SAPIEN Blog\",\"headline\":\"How to Run a Pester Test\",\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.sapien.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/clip_image002_thumb.jpg\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2016\\\/06\\\/13\\\/how-to-run-a-pester-test\\\/#articleImage\"},\"datePublished\":\"2016-06-13T06:00:00-07:00\",\"dateModified\":\"2016-07-13T11:33:38-07:00\",\"inLanguage\":\"en-US\",\"commentCount\":24,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2016\\\/06\\\/13\\\/how-to-run-a-pester-test\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2016\\\/06\\\/13\\\/how-to-run-a-pester-test\\\/#webpage\"},\"articleSection\":\"Behavior-Driven Development (BDD), Pester, Test-Driven Development, Testing, Windows PowerShell, BDD, Invoke-Pester, juneb, Pester, powershell, TDD, testing, unit test\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2016\\\/06\\\/13\\\/how-to-run-a-pester-test\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/#listItem\",\"name\":\"Windows PowerShell\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/#listItem\",\"position\":2,\"name\":\"Windows PowerShell\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2016\\\/06\\\/13\\\/how-to-run-a-pester-test\\\/#listItem\",\"name\":\"How to Run a Pester Test\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2016\\\/06\\\/13\\\/how-to-run-a-pester-test\\\/#listItem\",\"position\":3,\"name\":\"How to Run a Pester Test\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/#listItem\",\"name\":\"Windows PowerShell\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/\",\"name\":\"June Blender\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2016\\\/06\\\/13\\\/how-to-run-a-pester-test\\\/#webpage\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2016\\\/06\\\/13\\\/how-to-run-a-pester-test\\\/\",\"name\":\"How to Run a Pester Test - DEV SAPIEN Blog\",\"description\":\"Applies to: Pester 3.4.0 When you crack open the Pester module, you find the New-Fixture function, which creates a script and test file pair, and the Invoke-Pester function, which runs Pester tests. But New-Fixture is not the only way to create a Pester test and Invoke-Pester is not the only way to run a test.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2016\\\/06\\\/13\\\/how-to-run-a-pester-test\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\"},\"datePublished\":\"2016-06-13T06:00:00-07:00\",\"dateModified\":\"2016-07-13T11:33:38-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How to Run a Pester Test - DEV SAPIEN Blog","description":"Applies to: Pester 3.4.0 When you crack open the Pester module, you find the New-Fixture function, which creates a script and test file pair, and the Invoke-Pester function, which runs Pester tests. But New-Fixture is not the only way to create a Pester test and Invoke-Pester is not the only way to run a test.","canonical_url":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/#blogposting","name":"How to Run a Pester Test - DEV SAPIEN Blog","headline":"How to Run a Pester Test","author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author"},"publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2016\/06\/clip_image002_thumb.jpg","@id":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/#articleImage"},"datePublished":"2016-06-13T06:00:00-07:00","dateModified":"2016-07-13T11:33:38-07:00","inLanguage":"en-US","commentCount":24,"mainEntityOfPage":{"@id":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/#webpage"},"isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/#webpage"},"articleSection":"Behavior-Driven Development (BDD), Pester, Test-Driven Development, Testing, Windows PowerShell, BDD, Invoke-Pester, juneb, Pester, powershell, TDD, testing, unit test"},{"@type":"BreadcrumbList","@id":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/dev.sapien.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/#listItem","name":"Windows PowerShell"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/#listItem","position":2,"name":"Windows PowerShell","item":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/#listItem","name":"How to Run a Pester Test"},"previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/#listItem","position":3,"name":"How to Run a Pester Test","previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/#listItem","name":"Windows PowerShell"}}]},{"@type":"Organization","@id":"https:\/\/dev.sapien.com\/blog\/#organization","name":"DEV SAPIEN Blog","description":"Tools for IT Success","url":"https:\/\/dev.sapien.com\/blog\/"},{"@type":"Person","@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author","url":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/","name":"June Blender"},{"@type":"WebPage","@id":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/#webpage","url":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/","name":"How to Run a Pester Test - DEV SAPIEN Blog","description":"Applies to: Pester 3.4.0 When you crack open the Pester module, you find the New-Fixture function, which creates a script and test file pair, and the Invoke-Pester function, which runs Pester tests. But New-Fixture is not the only way to create a Pester test and Invoke-Pester is not the only way to run a test.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/#breadcrumblist"},"author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author"},"creator":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author"},"datePublished":"2016-06-13T06:00:00-07:00","dateModified":"2016-07-13T11:33:38-07:00"},{"@type":"WebSite","@id":"https:\/\/dev.sapien.com\/blog\/#website","url":"https:\/\/dev.sapien.com\/blog\/","name":"DEV SAPIEN Blog","description":"Tools for IT Success","inLanguage":"en-US","publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"DEV SAPIEN Blog - Tools for IT Success","og:type":"article","og:title":"How to Run a Pester Test - DEV SAPIEN Blog","og:description":"Applies to: Pester 3.4.0 When you crack open the Pester module, you find the New-Fixture function, which creates a script and test file pair, and the Invoke-Pester function, which runs Pester tests. But New-Fixture is not the only way to create a Pester test and Invoke-Pester is not the only way to run a test.","og:url":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/","article:published_time":"2016-06-13T13:00:00+00:00","article:modified_time":"2016-07-13T18:33:38+00:00","twitter:card":"summary_large_image","twitter:title":"How to Run a Pester Test - DEV SAPIEN Blog","twitter:description":"Applies to: Pester 3.4.0 When you crack open the Pester module, you find the New-Fixture function, which creates a script and test file pair, and the Invoke-Pester function, which runs Pester tests. But New-Fixture is not the only way to create a Pester test and Invoke-Pester is not the only way to run a test."},"aioseo_meta_data":{"post_id":"12192","title":null,"description":null,"keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-08-28 16:01:33","updated":"2026-08-28 16:01:33"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/\" title=\"Windows PowerShell\">Windows PowerShell<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow to Run a Pester Test\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/dev.sapien.com\/blog"},{"label":"Windows PowerShell","link":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/"},{"label":"How to Run a Pester Test","link":"https:\/\/dev.sapien.com\/blog\/2016\/06\/13\/how-to-run-a-pester-test\/"}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/12192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=12192"}],"version-history":[{"count":12,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/12192\/revisions"}],"predecessor-version":[{"id":12498,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/12192\/revisions\/12498"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=12192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=12192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=12192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}