Win32-OpenSSH/regress/pesterTests
Yanbing Wang c4d0727338 Source snapshot from Powershell/openssh-portable:latestw_all 2018-01-19 18:43:54 -08:00
..
testdata Source snapshot from Powershell/openssh-portable:latestw_all 2018-01-19 18:43:54 -08:00
Authorized_keys_fileperm.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2018-01-19 18:43:54 -08:00
CertAuth.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-10-17 15:52:28 -07:00
Cfginclude.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-06-30 18:36:09 -07:00
CommonUtils.psm1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-06-30 18:36:09 -07:00
Hostkey_fileperm.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-06-30 18:36:09 -07:00
KeyUtils.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2018-01-19 18:43:54 -08:00
Log_fileperm.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-10-17 15:52:28 -07:00
PlatformAbstractLayer.psm1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
PortForwarding.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-06-30 18:36:09 -07:00
PowerShell.SSH.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
README.md Source snapshot from Powershell/openssh-portable:latestw_all 2017-05-15 17:36:22 -07:00
SCP.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-07-19 17:19:24 -07:00
SFTP.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-06-30 18:36:09 -07:00
SSH.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-11-18 18:23:07 -08:00
SSHDConfig.tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2018-01-19 18:43:54 -08:00
SSHD_Config Source snapshot from Powershell/openssh-portable:latestw_all 2018-01-19 18:43:54 -08:00
Userkey_fileperm.Tests.ps1 Source snapshot from Powershell/openssh-portable:latestw_all 2017-11-18 18:23:07 -08:00
known_hosts Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
ssh_config Source snapshot from Powershell/openssh-portable:latestw_all 2017-05-15 17:36:22 -07:00
sshtest_ca_userkeys Source snapshot from Powershell/openssh-portable:latestw_all 2017-10-17 15:52:28 -07:00
sshtest_ca_userkeys.pub Source snapshot from Powershell/openssh-portable:latestw_all 2017-10-17 15:52:28 -07:00
sshtest_hostkey_dsa Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
sshtest_hostkey_dsa.pub Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
sshtest_hostkey_ecdsa Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
sshtest_hostkey_ecdsa.pub Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
sshtest_hostkey_ed25519 Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
sshtest_hostkey_ed25519.pub Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
sshtest_hostkey_rsa Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
sshtest_hostkey_rsa.pub Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
sshtest_userssokey_ed25519 Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07:00
sshtest_userssokey_ed25519.pub Source snapshot from Powershell/openssh-portable:latestw_all 2017-04-04 12:35:11 -07: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

Setup-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