Skip to content

SHAFT is a unified test automation engine for web, mobile, API, CLI, database, and desktop e2e testing. Powered by best-in-class frameworks, SHAFT provides a wizard-like syntax to drive your automation efficiently, maximize your ROI, and minimize your learning curve with no limitations! Stop reinventing the wheel! Upgrade now!

License

Notifications You must be signed in to change notification settings

ShaftHQ/SHAFT_ENGINE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SHAFT : Unified Test Automation Engine



Fully documented

User Guide
Award Winning

Google Open Source
Selenium Ecosystem

Selenium Ecosystem

Tech for Palestine
License Contributors Latest Release
E2E Tests Code QL
Codacy Codecov



📜 Table of Contents



🏃 Quick start guide

Option 1: Maven archetype

Tip

Recommended for new local sandbox projects.

  • The easiest and most straightforward way to create a new project that uses SHAFT.
  • Just follow the simple steps here ➡️ to generate your new project with one command (all configurations included).

Option 2: Start from scratch

Tip

Recommended if you're upgrading an existing project from Native Selenium WebDriver to SHAFT.

Step 1: Initial setup

  • Create a new Java/Maven project using the latest version from IntelliJ IDEA, Eclipse or your favourite IDE.
  • Copy the highlighted contents of this pom.xml file into yours inside the <project> tag.

Step 2: Creating tests

2.1. TestNG
  • Create a new Package testPackage under src/test/java
  • Create a new Java class TestClass under your newly created testPackage.
  • Copy the below imports into your newly created TestClass after the line that contains 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.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
  • Copy the below code snippet into the body of your TestClass after the line that contains public class TestClass {.
SHAFT.GUI.WebDriver driver;
SHAFT.TestData.JSON testData;

String targetUrl = "https://duckduckgo.com/";

By logo = By.xpath("//div[contains(@class,'container_fullWidth__1H_L8')]//img");
By searchBox = Locator.hasAnyTagName().hasAttribute("name", "q").build(); // synonym to By.name("q");
By firstSearchResult = Locator.hasTagName("article").isFirst().build(); // synonym to By.xpath("(//article)[1]");

@Test
public void navigateToDuckDuckGoAndAssertBrowserTitleIsDisplayedCorrectly() {
  driver.browser().navigateToURL(targetUrl)
          .and().assertThat().title().contains(testData.getTestData("expectedTitle"));
}

@Test
public void navigateToDuckDuckGoAndAssertLogoIsDisplayedCorrectly() {
  driver.browser().navigateToURL(targetUrl)
          .and().element().assertThat(logo).matchesReferenceImage();
}

@Test
public void searchForQueryAndAssert() {
  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() {
  testData = new SHAFT.TestData.JSON("simpleJSON.json");
}

@BeforeMethod
public void beforeMethod() {
  driver = new SHAFT.GUI.WebDriver();
}

@AfterMethod
public void afterMethod(){
  driver.quit();
}
2.2. JUnit5
--TODO--
2.3. Cucumber
--TODO--

Tip

In case you are planning to use Cucumber with IntelliJ IDEA, due to a known issue with IntelliJ you need to edit your run configuration template before running your tests by following these steps:
- Open 'Edit Run/Debug Configurations' dialog > Edit Configurations... > Edit configuration templates...
- Select Cucumber Java > Program Arguments > and add this argument:
--plugin com.shaft.listeners.CucumberFeatureListener
- After saving the changes, remember to delete any old runs you may have triggered by mistake before adding the needed config.

Step 3: Managing test data

  • Create the following file src/test/resources/testDataFiles/simpleJSON.json.
  • Copy the below code snippet into your newly created json file.
{
  "searchQuery": "SHAFT_Engine",
  "expectedTitle": "DuckDuckGo",
  "unexpectedInFirstResult": "Nope"
}

Step 4: Running tests

  • Run your TestClass.java either from the side menu or by pressing the run button.
  • On the first test run:
    • SHAFT will create a new folder src/main/resources/properties and generate some default properties files.
    • SHAFT will run in minimalistic test run mode and will self-configure its listeners under the src/test/resources/META-INF/services directory.

Tip

You can visit the user guide ➡️ to learn how to configure all SHAFT's properties.

  • On all following test runs:
    • After the run is complete, the Allure execution report will open automatically in your default web browser.
  • Join our GitHub Repo stars to get notified by email when a new release is pushed out.

Note

After upgrading your Engine to a new major release it is sometimes recommended to delete the properties folder src\main\resources\properties and allow SHAFT to regenerate the defaults by running any test method.



  • Check out our comprehensive and friendly user guide to learn why SHAFT should be your solution of choice if you're aiming for successful test automation.



🌍 Our success partners

Sponsors:


BrowserStack       Applitools       JetBrains     LambdaTest

Trusted solution of choice for: 1


_VOIS (Vodafone Intelligent Solution)       GET Group Holdings       MOMRA (Saudi Arabia's Ministry of Municipal and Rural Affairs)       Vodafone Egypt       Solutions by STC       GIZA Systems       Euronet       Terkwaz Business Solutions       Incorta       BayanTech       Adam.ai       ACT Global Soft       elmenus       IDEMIA       iHorizons       Robusta       Paymob Solutions       Jahez Group       Salt Bank       Baianat       



🚀 Features

Smart features

  • SHAFT provides a lot of out-of-the-box convenience features to facilitate your testing process and eliminate the need for boilerplate code.
  • All of SHAFT's smart features target the three pillars of successful test automation:
    • Scalability: The ability to run tests on multiple devices and browsers in parallel.
    • Reliability: The ability to run tests without flakiness and with detailed reporting.
    • Maintainability: The ability to easily maintain and update tests as the application changes.

Scalability:

CI/CD integration Cloud device farm integration Headless testing Parallel execution Containerized execution

Reliability:

Automated synchronization Logging Reporting Screenshots/Attachments Video recording

Maintainability:

Fluent design Locator builder Smart locators Native WebDriver access Element/Browser validations builder AI-powered visual validations

Supported platforms

Browsers:

Linux macOS Windows Android iOS
Google Chrome
Microsoft Edge _ _
Mozilla Firefox _ _
Apple Safari _ _ _

Apps:

Android iOS Windows
Native N/A
Hybrid N/A
Flutter N/A
WPF N/A N/A

Other:

API Database CLI PDF JSON YAML Excel Property

Test orchestration:

TestNG JUnit5 Cucumber



👨‍💻 Tech stack

Developed using:


Java      Maven       IntelliJ IDEA

Powered by:


       Selenium     Appium       
REST Assured    REST Assured       OpenCV       
TestNG       JUnit5       Cucumber Open       
Allure Reports       ReportPortal       
Selenium Grid       GitHub Actions       
Dependabot       CodeQL       Codacy       JaCoCo       CodeCov       sonatype



🤝 Support & contributions


automatest-workspace Automatest



Important

Stop Reinventing the wheel! Start using SHAFT!

SHAFT_ENGINE

Footnotes

  1. Company names are collected via anonymous surveys and provided freely by engineers who claimed to be using SHAFT_Engine within these companies.

About

SHAFT is a unified test automation engine for web, mobile, API, CLI, database, and desktop e2e testing. Powered by best-in-class frameworks, SHAFT provides a wizard-like syntax to drive your automation efficiently, maximize your ROI, and minimize your learning curve with no limitations! Stop reinventing the wheel! Upgrade now!

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Languages