A powerful, ready-to-use template for starting your end-to-end test automation with SHAFT_Engine.
- π Project Overview and Motivation
- β‘ Getting Started (Prerequisites and Dependencies)
- π Project Structure Breakdown (Critical Requirement)
- π― Usage and Running Tests
- πΈ Visual Demonstration (The Viral Component)
- π Support and Documentation
- π€ Contributing and License
This repository is a production-ready starter kit for SHAFT_Engine users, eliminating setup overhead and providing hands-on experience with core featuresβincluding Web, Mobile, API, and Database testing. SHAFT_Engine empowers engineers to write highly readable code, benefit from built-in reporting and logging, and leverage a unified API across multiple testing technologies.
Why Choose SHAFT_Engine?
- π§ Unified API for Web, Mobile, API, and Database testing
- π Built-in reporting with Allure integration and detailed logs
- π Highly readable and maintainable test code
- β‘ Zero configuration - works out of the box
- π Cross-browser support with Selenium Grid integration
- π CI/CD ready with GitHub Actions workflow included
Real-World Impact:
- Reduce test automation setup time from days to minutes
- Write maintainable tests that serve as living documentation
- Scale across multiple browsers and environments effortlessly
- Java Development Kit (JDK) 21+ (recommended JDK 24 for latest features)
- Apache Maven 3.6.3+
- Modern IDE (e.g., IntelliJ IDEA, Eclipse, VS Code with Java extensions)
- Docker (optional, for Selenium Grid testing)
-
Clone the repository:
git clone https://github.com/ShaftHQ/using_SHAFT_Engine.git cd using_SHAFT_Engine -
Build the project:
mvn clean compile
-
Install dependencies:
mvn clean install -DskipTests
-
Verify installation:
mvn test -Dtest=TestClass#navigateToDuckDuckGoAndAssertBrowserTitleIsDisplayedCorrectly
- Import the project as a Maven project
- Ensure the Project SDK is set to JDK 21+
using_SHAFT_Engine/
βββ π pom.xml # Maven build configuration
βββ π src/
β βββ π main/
β β βββ π resources/
β β βββ π properties/ # π§ Configuration hub
β β βββ π custom.properties # Custom configurations
β β βββ π log4j2.properties # Logging configuration
β β βββ π TestNG.properties # TestNG runner settings
β β βββ π cucumber.properties # Cucumber integration
β β βββ π reportportal.properties # ReportPortal integration
β β βββ π default/ # Default configuration fallbacks
β βββ π test/
β βββ π java/
β β βββ π testPackage/
β β βββ π TestClass.java # π§ͺ Sample test implementation
β βββ π resources/
β βββ π testDataFiles/ # π Test data storage
β β βββ π simpleJSON.json # JSON test data
β βββ π META-INF/
β βββ π services/ # Service configurations for listeners
βββ π .github/
β βββ π workflows/
β βββ π e2etests.yml # π CI/CD pipeline configuration
β βββ π sync-template.yml # π Automated template sync
βββ π target/ # π Generated reports and artifacts
βββ π logs/ # Detailed execution logs
βββ π surefire-reports/ # TestNG/JUnit reports
βββ π allure-report/ # Rich HTML reports
| Component | Purpose | Impact |
|---|---|---|
pom.xml |
Dependencies, plugins, and build profiles | Central project configuration |
TestClass.java |
Sample web automation tests using SHAFT_Engine API | Living documentation of framework capabilities |
properties/ |
Runtime configurations for different environments | Zero-code environment switching |
testDataFiles/ |
External test data (JSON, CSV, Excel) | Data-driven testing support |
e2etests.yml |
Multi-browser CI/CD pipeline | Automated testing across Chrome, Firefox, Edge |
sync-template.yml |
Automated template synchronization | Keeps repository files in sync with template |
Here's the actual test code included in this template:
package testPackage;
import com.shaft.driver.SHAFT;
import com.shaft.gui.internal.locator.Locator;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.testng.annotations.*;
public class TestClass {
SHAFT.GUI.WebDriver driver;
SHAFT.TestData.JSON testData;
String targetUrl = "https://duckduckgo.com/";
// SHAFT's fluent locator API - more readable than traditional By locators
By logo = By.xpath("//div[contains(@class,'container_fullWidth__1H_L8')]//img");
By searchBox = Locator.hasAnyTagName().hasAttribute("name", "q").build();
By firstSearchResult = Locator.hasTagName("article").isFirst().build();
@Test
public void navigateToDuckDuckGoAndAssertBrowserTitleIsDisplayedCorrectly() {
// Fluent API with built-in reporting and error handling
driver.browser().navigateToURL(targetUrl)
.and().assertThat().title().contains(testData.getTestData("expectedTitle"));
}
@Test
public void navigateToDuckDuckGoAndAssertLogoIsDisplayedCorrectly() {
// Visual regression testing built-in
driver.browser().navigateToURL(targetUrl)
.and().element().assertThat(logo).matchesReferenceImage();
}
@Test
public void searchForQueryAndAssert() {
// Data-driven testing with JSON files
driver.browser().navigateToURL(targetUrl)
.and().element().type(searchBox, testData.getTestData("searchQuery") + Keys.ENTER)
.and().assertThat(firstSearchResult).text()
.doesNotEqual(testData.getTestData("unexpectedInFirstResult"));
}
@BeforeClass
public void beforeClass() {
// Load test data from JSON file
testData = new SHAFT.TestData.JSON("simpleJSON.json");
}
@BeforeMethod
public void beforeMethod() {
// Create new driver instance for each test
driver = new SHAFT.GUI.WebDriver();
}
@AfterMethod
public void afterMethod() {
// Automatic cleanup
driver.quit();
}
}# Run all tests
mvn test
# Run specific test class
mvn test -Dtest=TestClass
# Run specific test method
mvn test -Dtest=TestClass#navigateToDuckDuckGoAndAssertBrowserTitleIsDisplayedCorrectly# Chrome (default)
mvn test -DtargetBrowserName=chrome
# Firefox
mvn test -DtargetBrowserName=firefox
# Microsoft Edge
mvn test -DtargetBrowserName=edge
# Headless execution
mvn test -DheadlessExecution=true# Download and start Selenium Grid
curl -o docker-compose.yml https://raw.githubusercontent.com/SeleniumHQ/docker-selenium/trunk/docker-compose-v3.yml
docker compose up --scale chrome=2 --scale firefox=2 -d
# Run tests against Grid
mvn test -DexecutionAddress=localhost:4444 -DtargetBrowserName=chrome# Parallel execution with custom threads
mvn test -DsetParallel=METHODS -DsetParallelMode=DYNAMIC -DthreadCount=3
# Generate Allure reports
mvn test -DgenerateAllureReportArchive=true
# Retry failed tests
mvn test -DretryMaximumNumberOfAttempts=2
# Custom test data environment
mvn test -DtestDataFolderPath=src/test/resources/testDataFiles/The template includes a JSON-based test data system:
{
"searchQuery": "SHAFT_Engine",
"expectedTitle": "DuckDuckGo",
"unexpectedInFirstResult": "Nope"
}Accessing test data in your tests:
// In @BeforeClass
testData = new SHAFT.TestData.JSON("simpleJSON.json");
// In test methods
String query = testData.getTestData("searchQuery");Coming Soon: Dynamic GIF showing a complete test run from execution to final HTML report generation.
SHAFT_Engine generates comprehensive reports automatically:
- Allure Reports: Interactive HTML reports with step-by-step screenshots
- TestNG Reports: Detailed execution summaries
- Custom Logs: Structured logging with different levels
- Screenshots: Automatic capture on failures and assertions
The included GitHub Actions workflow provides:
- β Multi-browser testing (Chrome, Firefox, Edge)
- π³ Dockerized Selenium Grid
- π Automatic report generation and archiving
- π Parallel execution across browser matrix
- π Test summaries and artifact uploads
- π SHAFT_Engine Documentation - Complete API reference and guides
- π Report Issues - Bug reports and feature requests
- π¬ Discussions - Community support and Q&A
- π Wiki - Advanced tutorials and best practices
Before Opening an Issue:
- Check existing issues
- Review the documentation
- Try the troubleshooting guide
When Opening an Issue, Include:
- SHAFT_Engine version (
mvn dependency:tree | grep SHAFT) - Java version (
java -version) - Operating System and Browser versions
- Complete error stack trace
- Minimal reproducible test case
- Start Here: Run the sample tests in this template
- Next: Explore the Getting Started Guide
- Advanced: Check out Best Practices
- Expert: Contribute to the SHAFT_Engine Core
We welcome contributions from the community! Here's how you can help:
- π Report Bugs: Found something broken? Open an issue
- π‘ Suggest Features: Have ideas for improvements? Start a discussion
- π Improve Documentation: Fix typos, add examples, or write guides
- π§ͺ Add Tests: Expand the test coverage with new examples
- π§ Code Contributions: Implement new features or fix bugs
- Fork this repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow existing code style and conventions
- Add tests for new functionality
- Update documentation for any API changes
- Ensure all tests pass before submitting
- Write clear commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License - Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files...
- SHAFT_Engine Team for creating this amazing framework
- Contributors who help improve this template
- Community members who provide feedback and support
Ready to revolutionize your test automation?
β Star this repository β’ π΄ Fork and customize β’ π Read the docs
Built with β€οΈ by the SHAFT_Engine community