A comprehensive automation and testing framework built with Selenium WebDriver and Java, specifically designed for testing Construct applications and projects. This framework provides a robust foundation for automated testing with WebDriverManager for browser management and Logback for logging.
- Selenium WebDriver 4.32.0 - Latest Selenium features and improvements
- WebDriverManager 6.1.0 - Automatic browser driver management
- Logback Logging - Comprehensive logging with configurable levels
- JUnit 5 Integration - Modern testing framework support
- Cross-Browser Testing - Support for Chrome, Edge, and other browsers
- Construct-Specific Methods - Specialized methods for testing Construct applications
- Page Object Model - Organized XPath management and element handling
- Utility Methods - Rich set of helper methods for common test operations
- Java 8+ - Java Development Kit
- Maven 3.6+ - Build and dependency management
- Supported Browsers - Chrome, Edge, Firefox (drivers managed automatically)
-
Clone the repository:
git clone https://github.com/Laserwolve-Games/ConstructAutomationFramework.git cd ConstructAutomationFramework
-
Install dependencies:
mvn clean install
-
Verify installation:
mvn test
ConstructAutomationFramework/
βββ src/
β βββ constructAutomation/
β βββ DaggerQuestTest.java # Sample test implementation
β βββ Methods.java # Core automation methods
β βββ Position.java # Position utilities
β βββ Xpaths.java # XPath repository
βββ resources/
β βββ logback.xml # Logging configuration
βββ images/
β βββ caffienelogo.png # Project assets
βββ pom.xml # Maven configuration
βββ README.md # This file
The framework uses Logback for logging. Configure logging levels in resources/logback.xml
:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36}.%M\(%line\) - %msg%n</pattern>
</encoder>
</appender>
<root level="error">
<appender-ref ref="STDOUT" />
</root>
</configuration>
WebDriverManager automatically handles browser driver downloads and management. No manual driver setup required!
package constructAutomation;
import org.junit.jupiter.api.Test;
class MyConstructTest extends Methods {
@Test
void testConstructApplication() {
// Start the desktop client
startDesktopClient();
// Perform test actions
click("playButton");
// Verify results
verifyTrue("Game started successfully",
(boolean) executeJavascript("return runtime.layout.getLayer('gameLayer').isVisible"));
// Clean up
quit();
}
}
The Methods
class provides numerous utility methods:
-
Browser Management:
startDesktopClient()
- Initialize browser for Construct testingquit()
- Close browser and clean up resources
-
Element Interaction:
click(String xpath)
- Click on elementssendKeys(String xpath, String text)
- Input textverifyTrue(String message, boolean condition)
- Assertions
-
JavaScript Execution:
executeJavascript(String script)
- Execute JavaScript in browser context
-
Verification:
verifyThrows(String message, Class<T> exception, ThrowingRunnable runnable)
- Exception testing
The Xpaths
class organizes all selectors:
// Example usage
click(Xpaths.AccountDropdown.logIn);
click(Xpaths.Dialog.AnimationsEditor.Animations.addAnimation);
# Run all tests
mvn test
# Run specific test class
mvn test -Dtest=DaggerQuestTest
# Clean and rebuild
mvn clean install
# Run tests with specific profile
mvn test -Dspring.profiles.active=test
The project includes pre-configured VS Code tasks:
- Maven Build:
Ctrl+Shift+P
β "Tasks: Run Task" β "Maven Build" - Maven Test:
Ctrl+Shift+P
β "Tasks: Run Task" β "Maven Test"
Test results are automatically generated and can be found in:
target/surefire-reports/
- JUnit test reports- Console output with timestamps and log levels
Adjust logging levels in logback.xml
:
trace
- Very detailed debuggingdebug
- General debugging informationinfo
- General informationwarn
- Warning messageserror
- Error messages only (default)
- Page Object Model: Keep XPaths organized in
Xpaths.java
- Method Reusability: Use methods from
Methods.java
for common operations - Clear Test Names: Use descriptive test method names
- Assertions: Always include meaningful assertion messages
- Clean Up: Always call
quit()
in test teardown
Dependency | Version | Purpose |
---|---|---|
Selenium Java | 4.32.0 | Web automation framework |
WebDriverManager | 6.1.0 | Automatic driver management |
Logback Classic | 1.5.18 | Logging framework |
JUnit Jupiter | Latest | Testing framework |
This project is licensed under the AGPL 3.0 License - see the LICENSE file for details.