Ellithium Utilities
The Ellithium framework provides a comprehensive set of utility libraries that simplify common test automation tasks. These utilities make it easier to handle data, files, assertions, and system interactions in your test code.
Available Utilities
Data Processing
Utility | Description |
---|---|
JSON Helper | Manipulate, read, and validate JSON data with support for nested structures, arrays, and complex operations. |
Excel Helper | Read and write Excel files using Apache POI with support for multiple sheets, formatting, and data manipulation. |
CSV Helper | Process CSV files with methods for reading, writing, filtering, and transforming tabular data. |
Text Helper | Handle plain text file operations including reading, writing, searching, and manipulating content. |
PDF Helper | Extract text, manipulate pages, and validate content in PDF documents using Apache PDFBox. |
Property Helper | Manage Java properties files with order preservation and enhanced functionality. |
System Integration
Utility | Description |
---|---|
JAR Extractor | Extract content from JAR files securely with protection against common vulnerabilities. |
Command Executor | Run OS commands with cross-platform support for Windows, macOS, and Linux. |
Test Support
Utility | Description |
---|---|
Test Data Generator | Generate realistic test data for various domains including personal info, addresses, and business data. |
Assertion Executor | Perform advanced assertions with detailed logging, supporting both hard and soft assertion modes. |
Configuration Properties | Configure framework behavior through property files for logging, reporting, and execution settings. |
Key Features
All utility classes in Ellithium share these common characteristics:
- Consistent Logging - Operations are logged through the Ellithium reporting system
- Error Handling - Robust error handling with meaningful error messages
- Thread Safety - Safe to use in parallel test execution environments
- Fluent API - Easy-to-use methods with intuitive naming
- Integration - Seamless integration with Ellithium test reports
Using Utilities in Your Tests
Importing and using utilities in your test code is straightforward:
import Ellithium.Utilities.generators.TestDataGenerator;
import Ellithium.Utilities.assertion.AssertionExecutor;
import Ellithium.Utilities.helpers.JsonHelper;
public class MyTest {
@Test
public void testUserRegistration() {
// Generate test data
String username = TestDataGenerator.getRandomUsername();
String email = TestDataGenerator.getRandomEmail();
// Create user and verify response
String response = userApi.createUser(username, email);
// Use JSON helper to parse and verify response
String userId = JsonHelper.getJsonKeyValue(response, "id");
// Use assertion executor for validation
AssertionExecutor.hard.assertNotNull(userId, "User ID should be generated");
AssertionExecutor.hard.assertTrue(userId.length() > 5, "User ID should be valid");
}
}
Best Practices
- Import only the specific utilities needed in each test class
- Consider creating wrapper classes for frequent utility operations in your specific domain
- Use soft assertions with
AssertionExecutor
when validating multiple conditions - Combine test data generation with property files for reproducible test runs
- Configure test behavior through the property files for consistent execution