- Create a new Java/Maven project using Eclipse, IntelliJ or your favourite IDE.
- Copy the highlighted contents of this pom.xml file into yours inside the
<project>
tag. - Follow the steps in this footnote in case you are using IntelliJ1.
- Create the following file
src/test/resources/testDataFiles/simpleJSON.json
. - Copy the below code snippet into your newly created json file.
{
"searchQuery": "SHAFT_Engine"
}
- Create a new Package under
src/test/java
and create a new Java Class under that package. - Copy the below code snippet into your newly created java class.
public class Test_Wizard_GUI {
SHAFT.GUI.WebDriver driver;
SHAFT.TestData.JSON testData;
By searchBox = By.name("q");
By resultStats = By.id("result-stats");
@Test
public void test() {
driver.browser().navigateToURL("https://www.google.com/");
driver.verifyThat().browser().title().isEqualTo("Google").perform();
driver.element().type(searchBox, testData.getTestData("searchQuery"))
.keyPress(searchBox, Keys.ENTER);
driver.assertThat().element(resultStats).text().doesNotEqual("")
.withCustomReportMessage("Check that result stats is not empty").perform();
}
@BeforeClass
public void beforeClass() {
driver = new SHAFT.GUI.WebDriver();
testData = new SHAFT.TestData.JSON("simpleJSON.json");
}
@AfterClass
public void afterClass() {
driver.quit();
}
}
- Run it as a TestNG Test Class.
- The execution report will open automatically in your default web browser after the test run is completed.
- You can change the target browser, operating system, timeouts, and other configurations using the ⚙️ Configuration Manager.
- Click Here for more GUI, API, DB, and CLI sample test classes.
- And you can learn more from the 📚 Javadocs and 👤 User Guide 2.
- Here is also a complete tutorial showing everything from creating the project to running remote, unattended, parallelized, cross-platform tests
▶️ Youtube: Test Automation Hero++ 3. - Lastly, feel free to Join us via Slack & Facebook for support and contributions.
- A Unified Test Automation Engine.
- A source controlled Java Maven project that is easily extended and regularly enhanced with new features.
- Provides an easily understandable and user-friendly syntax for writing simple, robust, reliable, maintainable, and scalable tests.
- Provides a ton of built-in features in the Test Execution and Test Adaptation layers of the Generic Test Automation Architecture, and allows you to focus on the Test Generation and Test Definition Layers.
- MIT Licensed Open-Source project that's free to use and easy to customize.
- Frequent updates full of new features and bug fixes.
- Helps you focus on writing simple tests without wasting time on any of the underlying boilerplate code and error handling.
- Maximize your Return On Investment by eliminating framework creation time, tool selection and training costs, and minimizing ramp up time.
- Start being productive immediately!
- If you're getting started with a new test automation project that focuses on any of the supported platforms.
- If you already have an existing test automation project that uses Selenium/Appium/RestAssured/TestNG/Java then using SHAFT will be a direct upgrade with ZERO refactoring required.
- Start by following the above Quick Start Guide
- You can also watch this 10-minute video
▶️ YouTube - How to do cross-browser test automation in 10 minutes (from scratch)
Who is using SHAFT? 4
- Join us via Slack & Facebook
- And feel free to create PRs directly. This lovely tutorial will help.
Footnotes
-
Due to a known issue with IntelliJ you need to edit your run configuration templates before running your tests by following these steps:
- Open 'Edit Run/Debug Configurations' dialog > Edit Configurations... > Edit configuration templates...
- Select TestNG > Listeners > and add these listeners one by one:com.shaft.tools.listeners.AlterSuiteListener
,com.shaft.tools.listeners.SuiteListener
,com.shaft.tools.listeners.InvokedMethodListener
- Select Cucumber Java > Program Arguments > and add this argument:--plugin com.shaft.tools.listeners.CucumberFeatureListener
- After saving the changes, remember to delete any old test runs you may have triggered by mistake before adding the needed config. ↩ -
The User Guide is still a work in progress. You can find a guide to contribute to it here SHAFT_Engine_Docusaurus, and feel free to Join us via Slack & Facebook for support and contributions. ↩
-
The Test Automation Hero++ Playlist is in Arabic. The working code itself is in English, and it's hosted here using_SHAFT_Engine_2. Feel free to Join us via Slack & Facebook for support and contributions. ↩
-
Company names are collected via anonymous surveys and provided freely by engineers who claimed to be using SHAFT_Engine within these companies. ↩