TestResults.io
  • What is TestResults.io
  • System Architecture
  • Regulated Markets
    • Health Care Industry
    • Financial Services Industry
  • What's new?
    • Update Instruction
      • Update of the Designer extension in Visual Studio
      • Update the Execution Engine
      • Update the Base- and Environment Models
    • Migration to new project file
  • Designer
    • Overview
    • First Steps
    • Installation
    • TestResults.io solution
    • The development environment
      • Tool Window Overview
        • Test Environments
          • Steps to configure a SUT VM
          • How to access files on the system under test
        • Remote Viewer
          • Control Mode
          • Capture Mode
          • Screen Editor
          • Capture Single Image
        • Screen Explorer
        • Test Case Designer
        • Image Explorer
        • API Testing
        • TestResults.io options
          • Engines
          • Servers
    • Test Cases
      • Adding Test Cases
      • Test Case structure
      • Simple Test Case (Example)
      • Executing your Test Case
      • Generating Test Containers
      • Publishing Test Cases
      • Execution Variables
    • Software Models
      • Adding SW Models
      • Referencing the Model in the Test Case
      • Generating Test Containers
      • Publishing SW Models
      • Screens and Screen Elements
        • Tables
        • Visual Sense
        • Custom Screen Elements
    • Installers
      • Adding Installers
      • Generating Test Containers
      • Publishing Installers
    • Automation Framework Reference
      • Attributes
      • Enumerations
      • Filters
        • IImageFilter Interface
        • Select
        • Resize
      • GlobalEngineParameters
      • ImageDetectionParameters
      • ImageReference
      • Interfaces
        • ITester Interface
          • ITester Methods
          • ITester Properties
        • ITestee Interface
          • ITestee Methods
        • IConnections Interface
          • IConnections Methods
          • IConnections Properties
        • IDebug Interface
        • IEngineResult
        • IHelpers Interface
        • IImageHelper Interface
          • IImageHelper Methods
        • IKeyboard Interface
          • IKeyboard Methods
        • IMouse Interface
          • IMouse Methods
          • IMouse Properties
        • IReport Interface
          • IReport Methods
        • ISUTConnection Interface
      • OcrEngineParameters
        • Best practise
        • IronOcrEngineParameters
        • LEADOcrEngineParameters
        • OcrEngineRelatedCharacters
        • OcrPreprocessingParameters
      • ResultRectangle
      • SutNotReadyException
      • TestStepAbortedException
    • FAQ
      • Two-factor authentication (2FA) and One Time Passwords (OTP)
      • Receive and verify Emails
      • Using Excel as test data source
      • Verify PDF Content
  • Portal
    • Overview
    • First Steps
    • User's Guide
      • Login
      • Projects
      • Dashboard
      • Test Cases
      • Software & Environments
      • Test Sets
      • Job Queue
      • Management
      • Notifications Summary
    • Automation Engineer's Guide
      • Test Automation Workflow
      • Automating a test case
      • Enabling Software & Environments
    • REST API Reference
      • Authentication
      • Projects
      • Test Sets
      • Test Cases
      • Test Plans
      • Test Reports
      • Files
      • Software
      • Environments
      • Untitled
      • Executions
      • Favorites
      • Statistics
      • User Management
      • Customer Management
      • Notifications
      • Configurations
      • Invoicing
  • Models
    • Overview
    • Base Model
      • BaseScreen
        • BaseScreen Properties
        • BaseScreen Methods
      • OnScreenElement
        • OnScreenElement Methods
        • OnScreenElement Properties
      • Primitives
        • Button
          • Button Methods
          • Button Properties
        • Checkbox
          • Checkbox Methods
        • ContextMenu
          • ContextMenu Methods
          • ContextMenu Properties
        • Dropdown
          • Dropdown Methods
          • Dropdown Properties
        • DropdownMenu
          • DropdownMenu Methods
          • DropdownMenu Properties
        • GenericScroller
          • GenericScroller Methods
          • GenericScroller Properties
        • HorizontalScroller
        • IconButton
          • IconButton Properties
        • Label
        • LabelWithButton
          • LabelWithButton Properties
        • LabelWithCheckbox
          • LabelWithCheckbox Properties
        • LabelWithValue
          • LabelWithValue Methods
          • LabelWithValue Properties
        • PwTextBox
          • PwTextBox Methods
        • TextBox
          • TextBox Methods
          • TextBox Properties
        • Tables and lists
          • Column
            • Column Methods
            • Column Properties
          • ItemList
            • ItemList Methods
            • ItemList Properties
          • Row
            • Row Methods
            • Row Properties
          • TableBase
            • TableBase Methods
            • TableBase Properties
        • LabelWithElementBase
          • LabelWithElementBase Properties
      • Enumerations
      • Extensions
        • EngineResultExtensions Methods
        • EnumExtensions Methods
        • ReportExtensions Methods
        • StringExtensions Methods
        • TesterConnectionExtensions Methods
        • TesterDebugExtensions Methods
        • TesterHelperExtensions Methods
        • TesterMouseExtensions Methods
        • TesterOnScreenElementExtensions
        • TesterSelectExtensions Methods
      • Helper Classes
        • BaseModelHelpers
          • BaseModelHelpers Methods
          • BaseModelHelpers Properties
        • Attributes for Designer
        • ListHelpers
      • Exceptions
        • ElementNotFoundException
        • InteractionFailedException
        • ScreenNotFoundException
      • Interfaces
        • IAppBasics Interface
          • IAppBasics Methods
          • IAppBasics Properties
        • IBrowser
        • ICommandLineWindow
        • IScroller Interface
          • IScroller Methods
          • IScroller Properties
        • ISutLocale Interface
          • ISutLocale Methods
          • ISutLocale Properties
        • ISystemHelpers
        • ISystemInteractions
        • IWindow
    • Environment Model
      • Windows
        • Screens
          • CmdWindow
            • CmdWindow Methods
            • CmdWindow Properties
          • FileDialog
            • FileDialog Methods
            • FileDialog Properties
          • FileExplorer
            • FileExplorer Properties
          • RunWindow
            • RunWindow Methods
            • RunWindow Properties
          • Window
            • Window Methods
            • Window Properties
        • SutLocale
          • SutLocale Methods
          • SutLocale Properties
        • SystemHelpers
          • SystemHelpers Methods
          • SystemHelpers Properties
        • SystemInteractions
        • WebBrowser
          • Browser
            • Browser Methods
            • Browser Properties
          • BrowserScroller
            • BrowserScroller Methods
            • BrowserScroller Properties
          • AuthenticationDialog
            • AuthenticationDialog Methods
            • AuthenticationDialog Properties
          • DownloadDialog
            • DownloadDialog Methods
            • DownloadDialog Properties
        • EnvironmentModel Enumerations
        • Interfaces
          • IWebAppBasics
            • IWebAppBasics Property
Powered by GitBook
On this page
  • CheckFileExists
  • CloseAllBrowsers
  • CopyFiles
  • CopyFolder
  • CreateFolderPath
  • DeleteFile
  • EnvironmentReady
  • GetCpuLoadPercentage
  • GetComputerName
  • GetFileAndFolderNames
  • GetOsBuildVersion
  • KillProcess
  • LogEnvironmentModelVersion
  • LoginRecentUser
  • OpenCommandLineWindow
  • OpenCommandLineWindowAsAdmin
  • OpenInExplorer Method
  • OpenWebUrl Method
  • RenameItem
  • RunProcess Method
  • SetUpRemoteDirectory Method
  • SetUpRemoteDirectory()
  • SetUpRemoteDirectory(Char)
  • StartHeartBeatMonitor
  • StopHeartBeatMonitor
  • UnzipFile

Was this helpful?

  1. Models
  2. Environment Model
  3. Windows
  4. SystemHelpers

SystemHelpers Methods

CheckFileExists

Checks if a file or folder exists on the SUT filesystem. To check if a folder exist pass in the folder with the path without the last "\" at the end. If stayInCmd is true, the cmd window is left open, otherwise it will be closed again.

Syntax:

public bool CheckFileExists(
    string fileWithPath,
    bool stayInCmd = false
)

Parameters:

Parameter

Description

fileWithPath

The full name of the file or folder to check.

[stayInCmd]

If stayInCmd is true, the cmd window is left open, otherwise it will be closed again.

Exceptions:

Exception

Condition

The command did not complete within 60 seconds.

CloseAllBrowsers

Closes all webbrowser windows that are not minimized. Warning for Close all tabs will be confirmed. Throws an exception if after 5 minutes not all windows could be closed.

Syntax:

public void CloseAllBrowsers()

Exceptions:

Exception

Condition

Browser was still open after several retries to close it.

CopyFiles

Copies the file(s) from the source path to the destination folder path using following cmd: xcopy /q /h /y "{source}" "{destination}". The name of the file will remain the same. Note: For copying folders including its subdirectories use CopyFolder instead.

Syntax:

public void CopyFile(
	string source,
	string destination,
	bool stayInCmd = false,
	int timeoutInSeconds = 300
)

Parameters:

Parameter

Description

source

The file (incl path) to be copied. Supports wildcard characters for copying multiple files in the source directory.

destination

The path of the destination folder where the file shall be copied to.

[stayInCmd]

If stayInCmd is true, the cmd window is left open, otherwise it will be closed again.

[timeoutInSeconds]

Exceptions:

Exception

Condition

Either the copying command did not complete within the timeoutInSeconds or the command completed with an error.

CopyFolder

Copies the folder (with all files and subfolders) from the source path to the destination folder path using following cmd: xcopy /q /i /e /h /y "{source}" "{destination}" If destination folder does not exist yet, it will be created.

Syntax:

public void CopyFile(
	string source,
	string destination,
	bool stayInCmd = false,
	int timeoutInSeconds = 300
)

Parameters:

Parameter

Description

source

The folder path to be copied.

destination

The path of the destination folder where the folder shall be copied to.

[stayInCmd]

If stayInCmd is true, the cmd window is left open, otherwise it will be closed again.

[timeoutInSeconds]

Exceptions:

Exception

Condition

Either the copying command did not complete within the timeoutInSeconds or the command completed with an error.

CreateFolderPath

Creates new folders for the specified path using mkdir command. If a path already exists, command will return an error, but no further action is done (the outcome of the CreateFolderPath method is unaffected).

Syntax:

public void CreateFolderPath(
	params string[] paths
)

Parameters:

Parameter

Description

paths

One or multiple path strings that should be created.

DeleteFile

Deletes a file or folder on the SUT filesystem. To delete a folder include the "\" at the end to indicate it's a folder. If stayInCmd is true, the cmd window is left open, otherwise it will be closed again.

Syntax:

public void DeleteFile(
    string fileWithPath,
    bool stayInCmd = false
)

Parameters:

Parameter

Description

fileWithPath

The full name of the file or folder to check (for a folder include \ at the end)

[stayInCmd]

If stayInCmd is true, the cmd window is left open, otherwise it will be closed again.

Exceptions:

Exception

Condition

The command did not complete within 60 seconds.

EnvironmentReady

Syntax:

public bool EnvironmentReady(
	bool checkSystemResponsive = true
)

Parameters:

Parameter

Description

[checkSystemResponsive]

Return Value:

Exceptions:

Exception

Condition

If the system is not responsive, a SUTNotReadyException is trown that will trigger a VM Redeployment for cloud VMs.

GetCpuLoadPercentage

Determines the current CPU load percentage on the SUT by running the wmic cpu get loadpercentage.

Syntax:

public int GetCpuLoadPercentage()

Return Value:

An integer value between 0 and 100 indicating the CPU load percentage on the SUT.

Exceptions:

Exception

Condition

Either the command to get the cpu load did not complete or the cpu load percentage could not be parsed from the response of the command.

GetComputerName

Gets the computer name of the SUT with the hostname command.

Syntax:

public string GetComputerName()

Return Value:

The computer name as a string.

Exceptions:

Exception

Condition

The command to get the computer name did not complete or did not return anything.

GetFileAndFolderNames

Returns a list of all file- and folder names contained in the specified folderPath that match the providedfileNameFilter. The result list is sorted by date/time, oldest first.

Syntax:

public IList<string> GetFileAndFolderNames(
    string folderPath,
    string fileNameFilter = ""
    bool stayInCmd = true
)

Return Value:

A List of filtered and sorted file/folder names.

Parameters:

Parameter

Description

folderPath

[fileNameFilter]

[stayInCmd]

Exceptions:

Exception

Condition

InteractionFailedException

When the command window cannot be opened after 3 retries.

GetOsBuildVersion

Gets the build version of the operating system on the SUT.

Syntax:

public string GetOsBuildVersion()

Return Value:

A string with the OS build version.

KillProcess

Kills a program or process from the run menu in windows (using Win-R key-shortcut).

Syntax:

public void KillProcess(
	string processName
)

Parameters:

Parameter

Description

processName

The name of the process that shall be killed.

LogEnvironmentModelVersion

Syntax:

public void LogEnvironmentModelVersion()

LoginRecentUser

Logs in the most recent user to windows from the welcome or lock screen if required. If login failed a TestStepAbortedException is thrown.

Syntax:

public void LoginRecentUser(
    string password = null
)

Parameters:

Parameter

Description

[password]

Optional parameter for the password. If not set (or NullOrEmpty) the password from the connection string is used.

OpenCommandLineWindow

Checks if a cmd window is already open on the screen, if not opens a new cmd window, if yes prepares it for new commands.

Syntax:

public ICommandLineWindow OpenCommandLineWindow()

Return Value:

Exceptions:

Exception

Condition

When the command window cannot be opened after 3 retries.

OpenCommandLineWindowAsAdmin

This is a Windows specific method and cannot be used on other environments! Checks if a cmd window is already open in administrator mode on the screen, if not closes any other cmd window and opens a new cmd window in administrator mode, if yes prepares it for new commands.

Syntax:

public ICommandLineWindow OpenCommandLineWindowAsAdmin()

Return Value:

Exceptions:

Exception

Condition

When the command window cannot be opened after 3 retries.

OpenInExplorer Method

Opens a folder or file, or starts a program from the file explorer.

Syntax:

public void OpenInExplorer(
	string path
)

Parameters:

Parameter

Description

path

The name of the folder path, file or program that shall be opened.

OpenWebUrl Method

Runs the webpage.bat from Installer directory that will open the target webpage for the SUT.

Syntax:

public Browser OpenWebUrl()

Return Value:

Exceptions:

Exception

Condition

When the browser window does not open after the wait time.

RenameItem

Renames the specified item to a new Name.

Syntax:

public void RenameItem(
    string itemPath,
    string newName,
    bool stayInCmd = false
)

Parameters:

Parameter

Description

itemPath

The item (including path) to rename

newName

The new name

[stayInCmd]

If true, the cmd window is left open, otherwise it will be closed again.Default false.

RunProcess Method

Starts a program or process from the run menu in windows (using Win-R key-shortcut).

Syntax:

public void RunProcess(
	string processName
)

Parameters:

Parameter

Description

processName

The name of the program or process that shall be run.

SetUpRemoteDirectory Method

Overload List

Name

Description

Mounts the remote directory that is provided by the execution host. If assigned drive is already in use, it is disconnected first. Uses default drive letter R.

Mounts the remote directory that is provided by the execution host to the specified drive. If assigned drive is already in use, it is disconnected first.

SetUpRemoteDirectory()

Mounts the remote directory that is provided by the execution host. If assigned drive is already in use, it is disconnected first. Uses default drive letter R.

Syntax:

public void SetUpRemoteDirectory( )

Exceptions:

Exception

Condition

Either the previous mapping could not be removed or the current remote directory could not be mapped.

SetUpRemoteDirectory(Char)

Mounts the remote directory that is provided by the execution host to the specified drive and updates ArtifactsDirectory, SupportingFilesDirectory etc accordingly. If assigned drive is already in use, it is disconnected. Note: The Drive Letter is not persisted from Installer to TestCase, so if you SetupRemoteDirectory in Installer, the TestCase will again default to 'R' for ArtifactsDirectory etc.

Syntax:

public void SetUpRemoteDirectory(
	char driveLetter
)

Parameters:

Parameter

Description

driveLetter

The drive letter to which the remote directory shall be mapped to.

Exceptions:

Exception

Condition

Either the previous mapping could not be removed or the current remote directory could not be mapped.

StartHeartBeatMonitor

Start to monitor heartbeat based on Windows clock.

Syntax:

public virtual void StartHeartBeatMonitor()

StopHeartBeatMonitor

Stop the heartbeat monitoring.

Syntax:

public virtual void StopHeartBeatMonitor()

UnzipFile

Extracts an archive (tested with zip, but potentially other archive types work as well) to the destination folder.

Syntax:

public void RunProcess(
	string pathToZipFile,
	string destinationPath,
	bool stayInCmd = false,
	int timeoutInSeconds = 300
)

Parameters:

Parameter

Description

pathToZipFile

The path to the zip file.

destinationPath

The path of the folder in which the zip file shall be extracted. With or without at the end. Will be created if it doesn't exist.

[stayInCmd]

If stayInCmd is true, the cmd window is left open, otherwise it will be closed again.

[timeoutInSeconds]

PreviousSystemHelpersNextSystemHelpers Properties

Last updated 1 year ago

Was this helpful?

Type:

Type:

Type:

Type:

Type:

Type:

The timeout for the copying command. If the command does not complete within this time a is thrown.

Type:

Type:

Type:

Type:

The timeout for the copying command. If the command does not complete within this time a is thrown.

Type: [ ]

Type:

Type:

This method checks that the desktop of the environment is completely loaded and checks the CPU load of the SUT from the cmd window to ensure the system is responsive (CPU load below 40%). If an is used, this should be called from installer step, otherwise from test case step.

Type: If this is false, the responsivenes check is disabled. True by default.

True if the system is responsive. Otherwise methods throws a that will trigger a VM Redeployment for cloud VMs.

Type: The folder path to get the file/folder names from

Type: Filter string that can contain wildcard characters '*' to substitute for any string of characters. For example: *.txt filters for all files ending with '.txt'

Type: If true, the cmd window is left open, otherwise it will be closed again. Default false.

Type:

Logs the name and version of the environment model contained in this assembly. Should be called in step of every test case using the environment model.

Type:

An instance of the class that allows to interact with the cmd window that was just opened.

An instance of the class that allows to interact with the cmd window that was just opened.

Type:

An instance of the class that allows to interact with the browser window that was just opened.

Type:

Type:

Type:

Type:

Type:

Type:

Type:

Type:

Type:

The timeout for the unzip command. If the command does not complete within this time a is thrown.

SUTNotReadyException
ICommandLineWindow
ICommandLineWindow
Browser
String
Boolean
TestStepAbortedException
TestStepAbortedException
String
String
Boolean
Int32
TestStepAbortedException
TestStepAbortedException
String
String
Boolean
Int32
TestStepAbortedException
TestStepAbortedException
String
String
Boolean
TestStepAbortedException
Boolean
SUTNotReadyException
TestStepAbortedException
TestStepAbortedException
String
String
Boolean
String
String
InteractionFailedException
InteractionFailedException
String
ElementNotFoundException
String
String
Boolean
String
TestStepAbortedException
Char
TestStepAbortedException
String
String
Boolean
Int32
TestStepAbortedException
SetUpRemoteDirectory()
SetUpRemoteDirectory(Char)
setup test
Precondition
Precondition
installer testcase