More Related Content Similar to それでも僕はユニットテストを書きたい - Pester powered by PowerShell (14) それでも僕はユニットテストを書きたい - Pester powered by PowerShell10. function Add-付加価値($path, $付加価値) {
Add-Content $path -Value $付加価値
}
Describe "Add-付加価値" {
$testPath = "TestDrive:付加価値のあるテキスト.txt"
Set-Content $testPath -value "ビジネスを円滑に進めるソリューション"
Add-付加価値 $testPath " -高い付加価値"
$result = Get-Content $testPath
It "adds a 付加価値" {
(-join $result) `
| Should Be "ビジネスを円滑に進めるソリューション -高い付加価値"
}
}
Pesterの特徴 ー 安全なテストのためのTestDrive
19. C:PS> Invoke-Pester .結果にコミットする.Tests.ps1 `
-CodeCoverage @{Path='.結果にコミットする.ps1'; Function='ライ●ップ'}
Code coverage report:
Covered 66.67 % of 3 analyzed commands in 1 file.
Missed commands:
File Function Line Command
---- -------- ---- -------
結果にコミットする.ps1 ライ●ップ 5 return '世界一のボディメイクを達成'
Pesterの特徴 ー デフォルトでCodeCoverageを計測可能
24. Pesterの情報
❏ Pester Wiki
❏ PowershellでPesterを使ってテストしてみた - なか日記
❏ PesterのMock機能をもう少し詳しく│株式会社シフト
❏ Get started with Pester (PowerShell unit testing framework)
❏ Testing your PowerShell scripts with Pester: Assertions and
more