首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Pester的调用-Pester住在哪里?

Pester的调用-Pester住在哪里?
EN

Stack Overflow用户
提问于 2014-12-05 18:43:49
回答 1查看 1.2K关注 0票数 1

根据这份文件,应该可以使用Pester度量代码覆盖率。

代码语言:javascript
复制
PS C:\path\to\codeCoverage> Invoke-Pester .\CoverageTest.Tests.ps1 -CodeCoverage .\CoverageTest.ps1

Invoke-Pester : The term 'Invoke-Pester' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Invoke-Pester .\CoverageTest.Tests.ps1 -CodeCoverage .\CoverageTest.ps1
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Invoke-Pester:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-12-05 18:47:54

读取这份文件后,显然需要在运行Invoke-Pester之前导入Pester模块

代码语言:javascript
复制
PS C:\path\to\codeCoverage> Import-Module "C:\ProgramData\Chocolatey\lib\pester.3.1.1\tools\Pester.psm1"
PS C:\path\to\codeCoverage> Invoke-Pester .\CoverageTest.Tests.ps1 -CodeCoverage .\CoverageTest.ps1
Executing all tests in 'C:\Users\r\Desktop\codeCoverage\CoverageTest.Tests.ps1'
Describing Demonstrating Code Coverage
 [+] Calls FunctionOne with no switch parameter set 1.8s
 [+] Calls FunctionTwo 287ms
Tests completed in 2.09s
Passed: 2 Failed: 0 Skipped: 0 Pending: 0

Code coverage report:
Covered 60.00 % of 5 analyzed commands in 1 file.

Missed commands:

File             Function    Line Command
----             --------    ---- -------
CoverageTest.ps1 FunctionOne    5 return 'SwitchParam was set'
CoverageTest.ps1 FunctionTwo   16 return 'I do not'
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27322627

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档