Skip to content

A collection of reusable C# code libraries designed to simplify and enhance test automation in Ranorex Studio.

License

Notifications You must be signed in to change notification settings

seriousQA/Ranorex-Methods-Libraries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ranorex-Methods-Libraries

Ranorex-Methods-Libraries is a collection of reusable C# code libraries designed to simplify and enhance test automation in Ranorex Studio. It provides setup, teardown, and utility methods for common automation tasks, making it easier to manage applications under test, handle files, process data, interact with external APIs, and automate routine operations in your test projects.

sharp net ranorex

GitHub issues GitHub pull requests GitHub stars

Table of Contents

Requirements

  • Ranorex Studio

How to use

  1. Add the .cs files to your project.
  2. Update the name of the initialised Ranorex repository to the name of your own repository.
  3. Use the methods in your record or code modules, e.g.:
// Example: Open an application and create a new project
SETUPlib.openApp("MyApp.exe");
// Example: Retriev email using Microsoft Graph API and RestSharp
METHODSlib.getMail(accessToken, emailAddress, folderID, subject, bodyPreview);

Libraries

SETUPlib

Is a SETUP code collection and includes:

  • openApp() - Run 32/64-bit application under test (AUT)
  • deleteRegKey() - Delete registry key for AUT
  • rmDir() - Remove traces (Documents, Roaming, etc.)
  • createNewProject() to start AUT and create a new project (GUI)
  • openProject() - Open a specific project in AUT (GUI)
  • resizeWindow() - Resize AUT window to monitor resolution
  • deleteFilesFromDir() - Remove test run files from results folder
  • checkDump() - Send a dump with comment (as GUI method example)
  • createFolderResult() - Create results folder for each AUT

SetKeyboardLayout TestModule is using to change Windows OS keyboard layout using C#. For example, U.S. English layout = "00010409", German layout = "00010407", Russian layout = "00010419". More Info from MSDN.

TheFirstRun TestModule is using to run 32-bit or 64-bit test application and resize window.

StartPopupWatcher TestModule is using to start a PopupWatcher to handle dialogs that can possibly come up during test run.

TEARDOWNlib

Is a TEARDOWN code collection and includes:

  • closeApp() - Kill AUT process
  • cleanUpResultsFolder() - Delete results folder
  • closeProjectWindow() - Close test product window (GUI)
  • closeAppInstances() - Close all AUT instances
  • killProcessTree() - Kill process tree using taskkill
  • killProcessAndChildren() - Kill process and children using ManagementObjectSearcher
METHODSlib

Is a collection of useful methods for test automation and includes:

Data

  • removeCharsInString() - Remove the last characters of string
  • getFirstChars() - Get first characters of string
  • getLastChars() - Get last characters of string
  • concatenateStrings() - Concatenate two strings
  • compareStrings() - Compare strings
  • validateAttIsNullOrEmpty() - validate the attribute value of repoItem isn't null or empty
  • getStringToLower() - Get a new string in which all the characters are converted to lowercase
  • getStringToUpper() - Get a new string in which all the characters are converted to uppercase

DateTime

  • getCurrentDate() - Get current date with specified format
  • getDateInNewFormat() - Get different date format
  • addMonths() - Add months to date (the same you can do with days or years)
  • getFileCreationTime() - Get the time of file creation

Files

  • getFileName() - Get file[0] name if exists

DevExpress

  • getCoordinates() - Get a coordinates of text in the PDF file

Random Generators

  • generateRandomString() - Generate random string
  • generateRandomInt() - Generate random integer

Excel

  • saveDataIntoExcelFile() - Save data into Excel file

TxtFile

  • validateDataInTxtFile() - Check if a specific line in a text file contains an expected value

RestSharp

  • getAccessToken() - Obtain access tokens using Microsoft Graph API and RestSharp
  • getMail() - Retriev emails using Microsoft Graph API and RestSharp
  • getAttachments() - Download attachments using Microsoft Graph API and RestSharp

KeePassLib

  • initializeKeePassDatabase() - Initialize a KeePass database
  • getEntryByTitle() - Retrieve entries by title and field

Contact

Questions, support, or contributions:

License

License: MIT

About

A collection of reusable C# code libraries designed to simplify and enhance test automation in Ranorex Studio.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages