update readme, runall and gitignore

Update installation instructions in README.

Added logging and log parsing to runall.ps1

Add ignore log files
This commit is contained in:
onyx-and-iris 2021-05-01 22:20:21 +01:00
parent 2846e46592
commit 2f1508e8f1
6 changed files with 65 additions and 15 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
**/*.psd1
**/*.log

View File

@ -9,6 +9,8 @@ Before any minor/major patch is released all test units will be run to verify th
## [Unreleased]
- [x] Add gain, comp, limit to Strips
- [x] Update tests to reflect changes
- [x] Add logging + summary for tests
- [x] Add info to README about powershellget, nuget and psgallery
## [1.3] - 2021-04-30
### Added

View File

@ -12,7 +12,7 @@ Simple example if using from source:
Import-Module .\lib\Voicemeeter.psm1
try {
# Pass a Voicemeeter type as argument
# Run the factory function for required Voicemeeter type
$vmr = Get-RemoteBanana
# Set strip and bus params

View File

@ -18,11 +18,23 @@ You may have success with many commands in earlier versions but some commands
- Powershell 5.1
## Installation
#### Powershell:
#### PowerShellGet:
In Powershell as admin:
`Install-Module Voicemeeter`
You will need to add PSGallery as a trusted repository source.
More info: [PSGallery](https://www.powershellgallery.com/)
In Powershell as current user:
`Install-Module -Name Voicemeeter -Scope CurrentUser`
You may be asked to install NuGet provider required by PowerShellGet if you don't have it already.
When prompted you will need to accept PSGallery as a trusted repository.
More Info:
- [PowerShellGet](https://docs.microsoft.com/en-us/powershell/scripting/gallery/installing-psget?view=powershell-7.1)
- [NuGet](https://www.powershellgallery.com/packages/NuGet/1.3.3)
- [PSGallery](https://docs.microsoft.com/en-gb/powershell/scripting/gallery/overview?view=powershell-7.1)
#### Direct download:
`git clone https://github.com/onyx-and-iris/voicemeeter-api-powershell.git`
@ -99,9 +111,7 @@ $vmr.button[5].trigger = $true
```
### Run tests
Run tests using invoke-pester in powershell console from test directory.
Alternatively you may use .\runall.ps1 which accepts two parameters:
Run tests using .\runall.ps1 which accepts two parameters:
- tag Run tests of this type
- num Run this number of tests
@ -109,3 +119,5 @@ Current test types are 'higher' and 'lower'
Example:
`.\runall.ps1 -tag 'higher' -num 3`
Results will be logged and summary file written.

View File

@ -402,9 +402,9 @@ Describe -Tag 'higher', -TestName 'All Alias Tests' {
$vmr.strip[1].gain | Should -Be 5.1
}
It 'Should set Strip[1].Gain to -0.2' {
$vmr.strip[1].gain =-0.2
$vmr.strip[1].gain | Should -Be -0.2
It 'Should set Strip[1].Gain to -4.2' {
$vmr.strip[1].gain = -4.2
$vmr.strip[1].gain | Should -Be -4.2
}
It 'Should set Strip[2].Gain to 2.7' {
@ -594,9 +594,9 @@ Describe -Tag 'higher', -TestName 'All Alias Tests' {
$vmr.bus[1].gain | Should -Be 5.1
}
It 'Should set Bus[1].Gain to -0.2' {
$vmr.bus[1].gain =-0.2
$vmr.bus[1].gain | Should -Be -0.2
It 'Should set Bus[1].Gain to -4.2' {
$vmr.bus[1].gain = -4.2
$vmr.bus[1].gain | Should -Be -4.2
}
It 'Should set Bus[2].Gain to 2.7' {

View File

@ -2,14 +2,49 @@ Param([String]$tag, [Int]$num=1)
Import-Module ..\lib\Voicemeeter.psm1
. ..\lib\base.ps1
Function ParseLog {
Param([String]$logfile)
$summary_file = "_summary.log"
if (Test-Path $summary_file) { Clear-Content $summary_file }
$PASSED_PATTERN = "^PassedCount\s+:\s(\d+)"
$FAILED_PATTERN = "^FailedCount\s+:\s(\d+)"
$DATA = @{
"passed" = 0
"failed" = 0
}
ForEach ($line in `
$(Get-content -Path "${logfile}")) {
if ($line -match $PASSED_PATTERN) {
$DATA["passed"] += $Matches[1]
}
elseif ($line -match $FAILED_PATTERN) {
$DATA["failed"] += $Matches[1]
}
}
"=========================`n" + `
"$num tests run:`n" + `
"=========================" | Tee-Object -FilePath $summary_file -Append
$DATA | ForEach-Object { $_ } | Tee-Object -FilePath $summary_file -Append
}
try
{
$vmr = Get-RemotePotato
$logfile = "_results.log"
if (Test-Path $logfile) { Clear-Content $logfile }
1..$num | ForEach-Object {
Write-Host "Running test $_ of $num"
Invoke-Pester -Tag $tag
"Running test $_ of $num" | Tee-Object -FilePath $logfile -Append
Invoke-Pester -Tag $tag -PassThru | Tee-Object -FilePath $logfile -Append
}
Parselog -logfile $logfile
}
finally
{