openssh-portable/regress/pesterTests
Tess Gauthier f168dca436 remove DSA from pester tests 2024-09-16 11:37:57 -04:00
..
data Added support for AuthorizedKeysCommand and AuthorizedPrincipalsCommand (#409) 2019-11-15 10:51:45 -08:00
utilities/askpass_util fix testbreak with SSH_ASKPASS change (#394) 2019-09-13 14:13:42 -07:00
AuthorizedKeysCommand.Tests.ps1 Fix failed tests - 1 2022-03-11 13:53:27 -08:00
Authorized_keys_fileperm.Tests.ps1 Change the way current platform is checked to use True automatic variable 2022-11-14 16:50:56 -05:00
CertAuth.Tests.ps1 Allow non-admin user processes to log message to ETW / log file (#513) 2021-06-11 16:56:04 -07:00
Cfginclude.Tests.ps1 Increase verbosity level for bad file permission (#489) 2021-03-26 17:12:13 -07:00
CommonUtils.psm1 Change the way current platform is checked to use True automatic variable 2022-11-14 16:50:56 -05:00
FileBasedLogging.tests.ps1 Only run the failing tests 2022-11-15 11:16:14 -05:00
Hostkey_fileperm.Tests.ps1 Change the way current platform is checked to use True automatic variable 2022-11-14 16:50:56 -05:00
KeyUtils.Tests.ps1 remove DSA from pester tests 2024-09-16 11:37:57 -04:00
Log_fileperm.Tests.ps1 Change the way current platform is checked to use True automatic variable 2022-11-14 16:50:56 -05:00
PlatformAbstractLayer.psm1 Enable all tests 2022-11-15 15:29:31 -05:00
PortForwarding.Tests.ps1 Change the way current platform is checked to use True automatic variable 2022-11-14 16:50:56 -05:00
PowerShell.SSH.Tests.ps1 Test scripts updates and readme (#97) 2017-03-29 12:48:26 -07:00
README.md CreateProcess with CREATE_NO_WINDOW flag (#413) 2019-12-09 10:54:18 -08:00
SCP.Tests.ps1 remove debug statements from pester tests 2023-12-01 15:49:33 -05:00
SFTP.Tests.ps1 Change the way current platform is checked to use True automatic variable 2022-11-14 16:50:56 -05:00
SSH.Tests.ps1 Fix typos 2022-11-16 10:37:16 -05:00
SSHDConfig.tests.ps1 Change the way current platform is checked to use True automatic variable 2022-11-14 16:50:56 -05:00
Setup.Tests.ps1 Spin up ssh-sk-helper in user context when called from ssh-agent (#560) 2022-02-01 18:46:19 -08:00
ShellHost.Tests.ps1 Run SSH and ShellHost tests 2022-11-15 15:00:13 -05:00
Uninstall.Tests.ps1 fix HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH registry permissions (#484) 2021-03-22 19:17:33 -07:00
Userkey_fileperm.Tests.ps1 rename variable to NoLibressl 2017-11-07 16:07:16 -08:00

README.md

Run OpenSSH Pester Tests:

To setup the test environment before test run:

Import-Module  .\openssh-portable\contrib\win32\openssh\OpenSSHTestHelper.psm1 Force
Setup-OpenSSHTestEnvironment

Set-OpenSSHTestEnvironment contains below parameters:

  • -OpenSSHBinPath: Specify the location where ssh.exe should be picked up. If not specified, the function will prompt to user if he/she want to choose the first ssh.exe found in $env:path if exists.
  • -TestDataPath: Specify the location where the test binaries deploy to. The default is $env:SystemDrive\OpenSSHTests if it not specified.
  • -Quiet: If it is set, the function will do all the changes without prompting to user to confirm.
  • -DebugMode: If it is set, the subsequent tests will be running in debug mode. User can modify by setting $OpenSSHTestInfo["DebugMode"] .

To run the test suites:

Run-OpenSSHE2ETest
Run-OpenSSHUnitTest

To run a particular test, just run the script or the executatlbe directly

C:\git\openssh-portable\regress\pesterTests\SCP.Tests.ps1
C:\git\openssh-portable\bin\x64\Release\unittest-bitmap\unittest-bitmap.exe

To verify / modify (Ex- DebugMode) the Test setup environment

$OpenSSHTestInfo
$OpenSSHTestInfo["DebugMode"] = $true

To revert what's done in Setup-OpenSSHTestEnvironment:

Cleanup-OpenSSHTestEnvironment

Guidelines for writing Pester based OpenSSH test cases

Follow these simple steps for test case indexing

  • Initialize the following variables at start
  $tC = 1
  $tI = 0
  • Place the following blocks in Describe
    BeforeEach {
        $stderrFile=Join-Path $testDir "$tC.$tI.stderr.txt"
        $stdoutFile=Join-Path $testDir "$tC.$tI.stdout.txt"
        $logFile = Join-Path $testDir "$tC.$tI.log.txt"
    }        
    AfterEach {$tI++;}
  • Place the following blocks in each Context
  BeforeAll {$tI=1}
  AfterAll{$tC++}
  • Prefix any test out file with $tC.$tI. You may use pre-created $stderrFile, $stdoutFile, $logFile for this purpose