Code Monkey home page Code Monkey logo

boyka-framework's Introduction

logo

๐ŸŽ‰ Ultimate test automation for testing any application on any platform

Don't forget to โญ the repository if you like it!

Product Hunt

Open in GitPod

Join Discord contributors last update Maven Central GitHub releases license


๐Ÿค” Why was Boyka-framework created?

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.

๐ŸŽฏ Features

  • โœ… 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

โฑ๏ธ Coming soon

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...

๐Ÿ‘€ Usage

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>

๐Ÿค“ Sample Code snippets

๐Ÿ› ๏ธ 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 ();

โ˜• Examples

๐Ÿ‘พ Tech Stack

๐Ÿ˜๏ธ Boyka Framework

Boyka core tech stack

๐Ÿ’ป Main project and Website

Boyka Main project tech stack

๐Ÿ’Ž Cloud platform supporters

Big thanks to the following organizations for their support to the project with their open source licenses:

Our supporters

๐Ÿ”— Links to our supporters

Check out the following links to our Cloud platform supporters to try it out, I bet you'll love these platforms:

๐Ÿงญ Project Road-map

Check out our road map to know which features we are cooking,

๐Ÿ‘‹ Contributing

These are our awesome contributors:

Contributors

Contributions are always welcome!

Check out contributing.md for ways to get started.

๐Ÿ“œ Code of Conduct

Please read the Code of Conduct

โš ๏ธ License

Distributed under MIT License.

๐Ÿค Contact

โญ Star History

Star History Chart

boyka-framework's People

Contributors

wasiqb avatar mfaisalkhatri avatar makodeajay avatar sahilpuri2020 avatar diogormendes avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.