PageSourceSearch

https://pester.dev/assets/js/f8394eca.c7601446.js

js pester.dev collected 2026-10-03 19:39:07 UTC 8,946 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkpester_docs=self.webpackChunkpester_docs||[]).push([["5065"],{7447(e,s,n){n.r(s),n.d(s,{metadata:()=>t,default:()=>h,frontMatter:()=>l,contentTitle:()=>i,toc:()=>d,assets:()=>o});var t=JSON.parse('{"id":"commands/Should-BeFasterThan","title":"Should-BeFasterThan","description":"Help for Pester command \'Should-BeFasterThan\'. Asserts that the provided [timespan] or [scriptblock] is faster than the expected [timespan].","source":"@site/docs/commands/Should-BeFasterThan.mdx","sourceDirName":"commands","slug":"/commands/Should-BeFasterThan","permalink":"/docs/commands/Should-BeFasterThan","draft":false,"unlisted":false,"editUrl":null,"tags":[],"version":"current","frontMatter":{"id":"Should-BeFasterThan","title":"Should-BeFasterThan","description":"Help for Pester command \'Should-BeFasterThan\'. Asserts that the provided [timespan] or [scriptblock] is faster than the expected [timespan].","keywords":["PowerShell","Pester","Help","Documentation"],"hide_title":false,"hide_table_of_contents":false,"custom_edit_url":null},"sidebar":"commands","previous":{"title":"Should-BeFalsy","permalink":"/docs/commands/Should-BeFalsy"},"next":{"title":"Should-BeGreaterThan","permalink":"/docs/commands/Should-BeGreaterThan"}}'),a=n(1987),r=n(7008);let l={id:"Should-BeFasterThan",title:"Should-BeFasterThan",description:"Help for Pester command 'Should-BeFasterThan'. Asserts that the provided [timespan] or [scriptblock] is faster than the expected [timespan].",keywords:["PowerShell","Pester","Help","Documentation"],hide_title:!1,hide_table_of_contents:!1,custom_edit_url:null},i,o={},d=[{value:"SYNOPSIS",id:"synopsis",level:2},{value:"SYNTAX",id:"syntax",level:2},{value:"DESCRIPTION",id:"description",level:2},{value:"EXAMPLES",id:"examples",level:2},{value:"EXAMPLE 1",id:"example-1",level:3},{value:"EXAMPLE 2",id:"example-2",level:3},{value:"PARAMETERS",id:"parameters",level:2},{value:"-Actual",id:"-actual",level:3},{value:"-Because",id:"-because",level:3},{value:"-Expected",id:"-expected",level:3},{value:"CommonParameters",id:"commonparameters",level:3},{value:"INPUTS",id:"inputs",level:2},{value:"System.Object",id:"systemobject",level:3},{value:"OUTPUTS",id:"outputs",level:2},{value:"NOTES",id:"notes",level:2},{value:"RELATED LINKS",id:"related-links",level:2},{value:"VERSION",id:"version",level:2}];function c(e){let s={a:"a",admonition:"admonition",code:"code",em:"em",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",ul:"ul",...(0,r.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.admonition,{title:"This page was generated",type:"info",children:(0,a.jsxs)(s.p,{children:["Contributions are welcome in ",(0,a.jsx)(s.a,{href:"https://github.com/pester/pester",children:"Pester-repo"}),"."]})}),"\n",(0,a.jsx)(s.h2,{id:"synopsis",children:"SYNOPSIS"}),"\n",(0,a.jsx)(s.p,{children:"Asserts that the provided [timespan] or [scriptblock] is faster than the expected [timespan]."}),"\n",(0,a.jsx)(s.h2,{id:"syntax",children:"SYNTAX"}),"\n",(0,a.jsx)(s.pre,{children:(0,a.jsx)(s.code,{className:"language-powershell",children:"Should-BeFasterThan [-Expected] <Object> [[-Actual] <Object>] [-Because <string>]\n"})}),"\n",(0,a.jsx)(s.h2,{id:"description",children:"DESCRIPTION"}),"\n",(0,a.jsxs)(s.p,{children:["This assertion accepts either a ",(0,a.jsx)(s.code,{children:"[timespan]"})," or a script block to measure.\nFluent time values such as ",(0,a.jsx)(s.code,{children:"1s"})," are converted to a ",(0,a.jsx)(s.code,{children:"[timespan]"})," before the comparison."]}),"\n",(0,a.jsx)(s.h2,{id:"examples",children:"EXAMPLES"}),"\n",(0,a.jsx)(s.h3,{id:"example-1",children:"EXAMPLE 1"}),"\n",(0,a.jsx)(s.pre,{children:(0,a.jsx)(s.code,{className:"language-powershell",children:"Measure-Command { Start-Sleep -Milliseconds 100 } | Should-BeFasterThan 1s\n"})}),"\n",(0,a.jsx)(s.p,{children:"This assertion will pass, because the actual value is faster than the expected value."}),"\n",(0,a.jsx)(s.h3,{id:"example-2",children:"EXAMPLE 2"}),"\n",(0,a.jsx)(s.pre,{children:(0,a.jsx)(s.code,{className:"language-powershell",children:"{ Start-Sleep -Milliseconds 100 } | Should-BeFasterThan 50ms\n"})}),"\n",(0,a.jsx)(s.p,{children:"This assertion will fail, because the actual value is not faster than the expected value."}),"\n",(0,a.jsx)(s.h2,{id:"parameters",children:"PARAMETERS"}),"\n",(0,a.jsx)(s.h3,{id:"-actual",children:"-Actual"}),"\n",(0,a.jsx)(s.p,{children:"The actual [timespan] or [scriptblock] value."}),"\n",(0,a.jsx)(s.pre,{children:(0,a.jsx)(s.code,{className:"language-yaml",children:"Type: System.Object\nDefaultValue: ''\nSupportsWildcards: false\nAliases: []\nParameterSets:\n- N
1ame: (All)\n  Position: 1\n  IsRequired: false\n  ValueFromPipeline: true\n  ValueFromPipelineByPropertyName: false\n  ValueFromRemainingArguments: false\nDontShow: false\nAcceptedValues: []\nHelpMessage: ''\n"})}),"\n",(0,a.jsx)(s.h3,{id:"-because",children:"-Because"}),"\n",(0,a.jsx)(s.p,{children:"The reason why the actual value should be faster than the expected value."}),"\n",(0,a.jsx)(s.pre,{children:(0,a.jsx)(s.code,{className:"language-yaml",children:"Type: System.String\nDefaultValue: ''\nSupportsWildcards: false\nAliases: []\nParameterSets:\n- Name: (All)\n  Position: Named\n  IsRequired: false\n  ValueFromPipeline: false\n  ValueFromPipelineByPropertyName: false\n  ValueFromRemainingArguments: false\nDontShow: false\nAcceptedValues: []\nHelpMessage: ''\n"})}),"\n",(0,a.jsx)(s.h3,{id:"-expected",children:"-Expected"}),"\n",(0,a.jsx)(s.p,{children:"The expected [timespan] or fluent time value."}),"\n",(0,a.jsx)(s.pre,{children:(0,a.jsx)(s.code,{className:"language-yaml",children:"Type: System.Object\nDefaultValue: ''\nSupportsWildcards: false\nAliases: []\nParameterSets:\n- Name: (All)\n  Position: 0\n  IsRequired: true\n  ValueFromPipeline: false\n  ValueFromPipelineByPropertyName: false\n  ValueFromRemainingArguments: false\nDontShow: false\nAcceptedValues: []\nHelpMessage: ''\n"})}),"\n",(0,a.jsx)(s.h3,{id:"commonparameters",children:"CommonParameters"}),"\n",(0,a.jsxs)(s.p,{children:["This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,\n-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,\n-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see\n",(0,a.jsx)(s.a,{href:"https://go.microsoft.com/fwlink/?LinkID=113216",children:"about_CommonParameters"}),"."]}),"\n",(0,a.jsx)(s.h2,{id:"inputs",children:"INPUTS"}),"\n",(0,a.jsx)(s.h3,{id:"systemobject",children:"System.Object"}),"\n",(0,a.jsx)(s.h2,{id:"outputs",children:"OUTPUTS"}),"\n",(0,a.jsx)(s.h2,{id:"notes",children:"NOTES"}),"\n",(0,a.jsxs)(s.p,{children:["The ",(0,a.jsx)(s.code,{children:"Should-BeFasterThan"})," assertion is the opposite of the ",(0,a.jsx)(s.code,{children:"Should-BeSlowerThan"})," assertion."]}),"\n",(0,a.jsxs)(s.p,{children:["Use the ",(0,a.jsx)(s.code,{children:"-ErrorAction"})," parameter to control soft-assertion behavior for this assertion.\n",(0,a.jsx)(s.code,{children:"-ErrorAction Continue"})," records the failure and lets the rest of the test run (a soft assertion), while ",(0,a.jsx)(s.code,{children:"-ErrorAction Stop"})," fails the test immediately, for example to guard a precondition before continuing."]}),"\n",(0,a.jsxs)(s.p,{children:["When ",(0,a.jsx)(s.code,{children:"-ErrorAction"})," is not specified, the behavior comes from ",(0,a.jsx)(s.code,{children:"Should.ErrorAction"})," in the configuration, which defaults to ",(0,a.jsx)(s.code,{children:"Stop"}),".\nSee ",(0,a.jsx)(s.a,{href:"https://pester.dev/docs/assertions/soft-assertions",children:"https://pester.dev/docs/assertions/soft-assertions"})," for more about soft assertions."]}),"\n",(0,a.jsx)(s.h2,{id:"related-links",children:"RELATED LINKS"}),"\n",(0,a.jsxs)(s.ul,{children:["\n",(0,a.jsx)(s.li,{children:(0,a.jsx)(s.a,{href:"https://pester.dev/docs/commands/Should-BeFasterThan",children:"https://pester.dev/docs/commands/Should-BeFasterThan"})}),"\n",(0,a.jsx)(s.li,{children:(0,a.jsx)(s.a,{href:"https://pester.dev/docs/assertions",children:"https://pester.dev/docs/assertions"})}),"\n"]}),"\n",(0,a.jsx)(s.h2,{id:"version",children:"VERSION"}),"\n",(0,a.jsx)(s.p,{children:(0,a.jsxs)(s.em,{children:["This page was generated using comment-based help in ",(0,a.jsx)(s.a,{href:"https://github.com/pester/pester",children:"Pester 6.1.0"}),"."]})})]})}function h(e={}){let{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,a.jsx)(s,{...e,children:(0,a.jsx)(c,{...e})}):c(e)}},7008(e,s,n){n.d(s,{R:()=>l,x:()=>i});var t=n(1763);let a={},r=t.createContext(a);function l(e){let s=t.useContext(r);return t.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function i(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:l(e.components),t.createElement(r.Provider,{value:s},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.