Selcukes Documentation
website·Indexed 29 days ago
https://selcukes.github.io/docsAn open-source automation solution and testing library for Web, Desktop, Mobile, and API endpoints. Features include DataBind for parsing JSON, YML, XML, and CSV; ExcelMapper for .xlsx files; a Video Recorder for tests; and integration with TestNG, Extent Reports, and Selenoid Grid.
What's inside Selcukes
- WebDriver Binaries is an open-source Java library designed to automate the management of binary drivers (e.g., chromedriver, geckodriver, msedgedriver) required by Selenium WebDriver. It handles the platform-specific download of the correct driver version based on the installed browser, configures the necessary Java system properties, and manages a local cache to ensure compatibility and performance.
Overview of the Selcukes automation framework
Selcukes is an open-source, all-in-one automation solution used to test Web, Desktop, Mobile, and API services. It provides a unified Framework API, meaning the same syntax is used across all supported platforms, allowing developers to apply their web testing knowledge to mobile, desktop, and API testing immediately. Key features include automatic waiting (eliminating the need for manual sleeps or waits) and readable error stack traces for faster debugging.Overview of Selcukes testing library
Selcukes is an open-source testing library designed for creating scalable automated tests across web, mobile, desktop applications, and API endpoints. Key capabilities include:
- Adding new test logic without causing regressions
- Full control over execution workflows (including browser reuse and changes)
- Automatic retry of failing tests
- UI automation on emulators and real devices
- Cross-platform screenshot and video recording upon test failure for debugging
Create category cards for overview pages
For overview pages with four categories, use thebox-wrapperandcardHTML structure. Note that Markdown is not supported inside these HTML blocks; use standard HTML tags for formatting.<div className="box-wrapper" markdown="1"> <div className="box box1 card"> <div className="container"> <h2>Box 1</h2> <p>Box 1 things.</p> <ul> <li><a href="">Link 1</a></li> <li><a href="">Link 2</a></li> </ul> </div> </div> <!-- Repeat for box2, box3, box4 --> </div>Handle PropertiesMapper exceptions
When errors occur during the parsing or writing of files,PropertiesMapperthrows aDataMapperException. This exception contains details about the failure and the underlying cause.Handle ExcelMapper exceptions
If an error occurs during the parsing or writing of an Excel file,ExcelMapperthrows aDataMapperException. This exception contains details about the failure and the underlying cause.Handle CsvMapper parsing and writing errors
When usingCsvMapperfor parsing or writing files, be prepared to handleDataMapperException. This exception is thrown when an error occurs during file processing and contains details about the failure and the underlying cause.Reference GitHub code using version tags
To prevent code examples from becoming stale, reference code fromdemo-<language>repositories using semantic version tags (e.g.,docs-1.0) instead of branch names or commit hashes. This is achieved via a custom Docusaurus plugin.git tag -a -m 'reference for Selcukes documentation' docs-<version> git push origin --tagsParse Excel sheets into entity class objects
Use
ExcelMapper.parse(Class<T> entityClass)to convert an Excel sheet into a stream of Java objects.Mapping is configured via annotations on the entity class:
@DataFile: Specifies thefileNameandsheetName. IffileNameis omitted, it defaults to the SnakeCase of the class name with a.xlsxsuffix. IfsheetNameis omitted, the first sheet is used.@Key: Maps a class field to a specific Excel column name using thenameattribute. It also supports aformatattribute for date parsing (e.g.,MM-dd-yyyy).
public class ReadExcelTest { @Data @DataFile(fileName = "TestData.xlsx", sheetName = "Yahoo") static class TestData { @Key(name = "First Name") String firstName; @Key(name = "Last Name") String lastName; @Key(name = "DOB", format = "MM-dd-yyyy") LocalDate dob; String location; } @Test public void excelMapperTest() { Stream<TestData> dataStream = ExcelMapper.parse(TestData.class); dataStream.forEach(System.out::println); } }Substitute Excel values using custom interpolators
Use the@Interpolateannotation on an entity class to substitute field values (e.g.,${DATE}) during parsing. To use a custom substitution logic, extendDefaultSubstitutorand override thereplace(String strToReplace, String format)method, then specify the class in the@Interpolateannotation.public class FakerDataSubstitutor extends DefaultSubstitutor { @Override public String replace(String strToReplace, final String format) { return FakerUtils.substitute(strToReplace); } } // Usage in Entity @Interpolate(substitutor = FakerDataSubstitutor.class) @Data @DataFile(fileName = "TestData.xlsx") static class TestData { @Key(name = "First Name") String firstName; }Parse a CSV file into a DataTable using CsvMapper
Use theCsvMapper.parse()method to read a CSV file from a givenPathand convert it into aDataTable<String, String>. You can use the default regex for parsing or provide a custom regex to handle specific CSV formats.// Method 1: Using Default Regex Path filePath = Paths.get("path/to/your/file.csv"); DataTable<String, String> dataTable = CsvMapper.parse(filePath); // Method 2: Using Custom Regex Path filePath = Paths.get("path/to/file.csv"); DataTable<String, String> dataTable = CsvMapper.parse(filePath, CsvMapper.CSV_REGEX);Understand the WebDriver binary resolution algorithm
When
setup()is called, WebDriver Binaries performs the following steps:- Browser Version Discovery: Uses a internal database of shell commands (e.g.,
google-chrome --version) to find the installed browser version. - Driver Version Mapping: Identifies the compatible driver version based on the browser version using maintainer-provided resources.
- Download & Cache: Downloads the binary to a local cache (default:
%temp%/webdrivers). - System Property Export: Sets the corresponding Java system property (e.g.,
webdriver.chrome.driver) to the path of the downloaded binary.
To optimize performance, a resolution cache (
version.properties) is used with a default Time-To-Live (TTL) of 1 hour, reducing the need for repeated shell commands or external network requests.- Browser Version Discovery: Uses a internal database of shell commands (e.g.,