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.
- Ranorex Studio
- Add the
.cs
files to your project. - Update the name of the initialised Ranorex repository to the name of your own repository.
- 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);
SETUPlib
Is a SETUP code collection and includes:
openApp()
- Run 32/64-bit application under test (AUT)deleteRegKey()
- Delete registry key for AUTrmDir()
- 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 resolutiondeleteFilesFromDir()
- Remove test run files from results foldercheckDump()
- 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 processcleanUpResultsFolder()
- Delete results foldercloseProjectWindow()
- Close test product window (GUI)closeAppInstances()
- Close all AUT instanceskillProcessTree()
- Kill process tree usingtaskkill
killProcessAndChildren()
- Kill process and children usingManagementObjectSearcher
METHODSlib
Is a collection of useful methods for test automation and includes:
Data
removeCharsInString()
- Remove the last characters of stringgetFirstChars()
- Get first characters of stringgetLastChars()
- Get last characters of stringconcatenateStrings()
- Concatenate two stringscompareStrings()
- Compare stringsvalidateAttIsNullOrEmpty()
- validate the attribute value of repoItem isn't null or emptygetStringToLower()
- Get a new string in which all the characters are converted to lowercasegetStringToUpper()
- Get a new string in which all the characters are converted to uppercase
DateTime
getCurrentDate()
- Get current date with specified formatgetDateInNewFormat()
- Get different date formataddMonths()
- 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 stringgenerateRandomInt()
- 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 RestSharpgetMail()
- Retriev emails using Microsoft Graph API and RestSharpgetAttachments()
- Download attachments using Microsoft Graph API and RestSharp
KeePassLib
initializeKeePassDatabase()
- Initialize a KeePass databasegetEntryByTitle()
- Retrieve entries by title and field
Questions, support, or contributions: