In my career having vast experience in automating API, Web browsers and Mobile apps, I have seen that people had to use different frameworks for automating API, Web and Mobile applications which created a lot of chaos with respect to maintenance of dependencies and their respective code for test automation.
Also, I never came across a test automation framework which allowed us to write automation test script without any project specific boilerplate code or a mini framework.
In addition to this, there was learning curve involved for learning those individual frameworks which slowed down the team to write automation and thus increased overall automation debt.
This all gave me an idea of having a single framework which could solve all the above mentioned problems and help the QA's to keep the pace up with writing test scripts and reduce the automation debt.
- โ Zero boilerplate code
- โ Support Rest API automation with schema validations and response body verification
- โ Supports Web browser automation with support for Chrome, Edge, Firefox and Safari.
- โ Supports execution of Web tests on cloud platforms like BrowserStack and LambdaTest.
- โ
Highly configurable via
boyka-config.json
- โ Micro logging to log events of the test execution
- โ Supports taking screenshots
Following are the awesome features which will be implemented soon to the frameworks:
- Support for Android automation
- Support for iOS automation
- Support for GraphQL and SOAP API automation
- Support video recording of the tests for Web and Mobile platforms
- Support for more cloud platforms.
- Many many more...
Use this space to tell a little more about your project and how it can be used. Show additional screenshots, code samples, demos or link to other resources.
<dependency>
<groupId>com.github.wasiqb.boyka</groupId>
<artifactId>boyka-framework</artifactId>
<version>0.8.1</version>
</dependency>
๐ ๏ธ Boyka Config file
This is the configuration file for Boyka Framework named boyka-config.json
stored at src/test/resources
folder.
{
"ui": {
"timeout": {
"implicit_wait": 10,
"explicit_wait": 30,
"page_load_timeout": 30,
"script_timeout": 10
},
"screenshot": {
"enabled": true,
"path": "./screenshots",
"extension": "jpeg",
"prefix": "SCR"
},
"web": {
"test_local_chrome": {
"browser": "CHROME",
"resize": "CUSTOM"
},
"test_local_firefox": {
"browser": "FIREFOX"
},
"test_local_edge": {
"browser": "EDGE"
},
"test_local_safari": {
"browser": "SAFARI"
},
"test_browserstack_chrome": {
"browser": "REMOTE",
"cloud": "BROWSER_STACK",
"protocol": "HTTPS",
"host": "hub-cloud.browserstack.com",
"user_name": "${env:BS_USER}",
"password": "${env:BS_KEY}",
"capabilities": {
"browser": "Chrome",
"browser_version": "latest",
"os": "Windows",
"os_version": "10",
"resolution": "1920x1080",
"project": "Test Boyka Project",
"build": "Test BrowserStack Build",
"name": "Test BrowserStack Session"
}
},
"test_selenium_grid": {
"browser": "REMOTE",
"cloud": "NONE",
"port": "4444",
"capabilities": {
"browserName": "chrome",
"platform": "MAC"
}
},
"test_lambda_test_chrome": {
"browser": "REMOTE",
"cloud": "LAMBDA_TEST",
"protocol": "HTTPS",
"host": "hub.lambdatest.com",
"user_name": "${env:LT_USER}",
"password": "${env:LT_KEY}",
"capabilities": {
"browserName": "Chrome",
"version": "99.0",
"platform": "Windows 10",
"resolution": "1920x1080",
"build": "Test LambdaTest Build",
"name": "Test LambdaTest Session",
"network": true,
"visual": true,
"video": true,
"console": true
}
}
}
},
"api": {
"test_reqres": {
"base_uri": "https://reqres.in",
"base_path": "/api",
"read_timeout": 2,
"write_timeout": 2,
"connection_timeout": 1,
"logging": {
"request": true,
"response": true
},
"schema_path": "schema/"
}
}
}
๐ชข API Sample
Add your response schema JSON files at the directory mentioned in config under src/test/resources
folder.
-| /src
|__ /test
|__ /resources
|__ /schemas # This folder path mentioned in config file.
|__ create-user-schema.json
Here's how you can execute the API test and also verify its response.
// Create request body object
final User user = User.createUser ()
.name ("Wasiq")
.job ("Software Engineer")
.create ();
// Compose request
final ApiRequest request = ApiRequest.createRequest ()
.configKey (API_CONFIG_KEY)
.method (POST)
.path ("/users")
.bodyObject (user)
.create ();
// Execute request
final ApiResponse response = ApiManager.execute (request);
// Verify response status code
response.verifyStatusCode ()
.isEqualTo (201);
// Verify response schema
response.verifySchema ("create-user-schema.json");
// Verify response body
response.verifyTextField ("id")
.isNotNull ();
response.verifyTextField ("name")
.isEqualTo (user.getName ());
response.verifyTextField ("job")
.isEqualTo (user.getJob ());
response.verifyTextField ("createdAt")
.isNotNull ();
๐ป Web Sample
This is how we can create page object.
package com.github.wasiqb.boyka.testng.web.saucedemo.pages;
import com.github.wasiqb.boyka.builders.Locator;
import org.openqa.selenium.By;
import lombok.Getter;
@Getter
public class LoginPage {
public static LoginPage loginPage () {
return new LoginPage ();
}
private final Locator loginBox = Locator.buildLocator ()
.web (By.id ("login_button_container"))
.build ();
private final Locator loginButton = Locator.buildLocator ()
.web (By.id ("login-button"))
.parent (this.loginBox)
.build ();
private final Locator password = Locator.buildLocator ()
.web (By.id ("password"))
.parent (this.loginBox)
.build ();
private final Locator username = Locator.buildLocator ()
.web (By.id ("user-name"))
.parent (this.loginBox)
.build ();
private LoginPage () {
// Avoid explicit class initialization.
}
}
And later we can use that page object to execute the test.
import static com.github.wasiqb.boyka.actions.DriverActions.navigateTo;
import static com.github.wasiqb.boyka.actions.DriverActions.takeScreenshot;
import static com.github.wasiqb.boyka.actions.KeyboardActions.enterText;
import static com.github.wasiqb.boyka.actions.KeyboardActions.pressKey;
import static com.github.wasiqb.boyka.actions.MouseActions.clickOn;
import static com.github.wasiqb.boyka.actions.VerifyDriverActions.verifyBrowserTitle;
import static com.github.wasiqb.boyka.actions.VerifyDriverActions.verifyBrowserUrl;
import static com.github.wasiqb.boyka.actions.VerifyElementActions.verifyElementDisplayed;
import static com.github.wasiqb.boyka.actions.VerifyElementActions.verifyElementEnabled;
import static com.github.wasiqb.boyka.manager.DriverManager.closeDriver;
import static com.github.wasiqb.boyka.manager.DriverManager.createDriver;
import static com.github.wasiqb.boyka.testng.web.saucedemo.pages.LoginPage.loginPage;
import static java.text.MessageFormat.format;
import static org.openqa.selenium.Keys.CONTROL;
import static org.openqa.selenium.Keys.DELETE;
. . .
createDriver (ApplicationType.WEB, "test_local_chrome");
. . .
private static final String URL = "https://www.saucedemo.com";
. . .
navigateTo (URL);
verifyBrowserUrl ().startsWith (URL);
enterText (loginPage ().getUsername (), "standard_user");
pressKey (loginPage ().getUsername (), CONTROL, "a", DELETE);
enterText (loginPage ().getUsername (), "standard_user");
enterText (loginPage ().getPassword (), "secret_sauce");
clickOn (loginPage ().getLoginButton ());
verifyBrowserUrl ().isEqualTo (format ("{0}/inventory.html", URL));
verifyBrowserTitle ().isEqualTo ("Swag Labs");
verifyElementDisplayed (homePage ().getMenuButton ()).isTrue ();
verifyElementEnabled (homePage ().getMenuButton ()).isTrue ();
takeScreenshot ();
. . .
closeDriver ();
- API:
- Web:
Big thanks to the following organizations for their support to the project with their open source licenses:
Check out the following links to our Cloud platform supporters to try it out, I bet you'll love these platforms:
Check out our road map to know which features we are cooking,
These are our awesome contributors:
Contributions are always welcome!
Check out contributing.md
for ways to get started.
Please read the Code of Conduct
Distributed under MIT License.
- Join our Discord server to discuss anything about the framework
- Open a new Discussion on GitHub to ask questions or to discuss ideas
- Contact / Follow me on Twitter, LinkedIn
- For more details about the framework, checkout our website