autonomx / Autonomx

Autonomx provides a complete testing platform for UI (Web, iOS, Android, Win) and API testing. It provides a feature rich and viable testing solution for end to end testing. It's designed to be fast, scalable, reliable and adaptable to any requirements for ever growing projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Maven Central

Documentation: https://autonomx.gitbook.io/autonomx/

Autonomx Core: https://github.com/autonomx/AutonomxCore

Autonomx

Autonomx provides a complete testing platform for UI (Web, iOS, Android, Win) and API testing. It provides a feature rich and viable testing solution for end to end testing. They’re designed to be fast, scalable, reliable and adaptable to any requirements for ever growing projects. 

Overview

  • Open source UI automation testing framework based on Webdriver/Appium, TestNG/Junit, with maven integration.
  • Unifies mobile and web testing, using a common, version controlled code base (Autonomx Core)
  • Each testing project is treated as a client for the Autonomx Core, meaning one central code base for all UI testing projects
  • A client can have multiple test projects, as well as multiple platforms (web, Android, iOS, Win), associated with it.
  • Modular design. Each project/component is treated as a module,  fully capable of interacting with one another. This allows for multi component and multiplatform testing. Eg. Create user through component A (API), validate in component B (web), do action in component C (Android), validate results in component D (iOS)
  • All interaction with the UI are through utility functions called Helpers, which are stable and optimized set of wrapper functions, removing inconsistencies in coding styles and enforcing testing best practices
  • Integrates seamlessly with the API testing framework for end to end testing
  • Detailed reports through ExtentTest reports

Prerequisites:

Web:

Android:

iOS:

IDE Setup

Getting Started:

  • Download the latest release of Autonomx based on your project needs
  • Run the setup:
  • setup.bat (windows), setup.sh (osx, linux)
  • This will download maven if not installed, and all the required dependencies
  • Navigate to runner//. eg. runner/mac/restTests.sh
  • The run scripts are generated from testng testSuites by runner/generateScripts.sh. Each script is associated with a suite of tests
  • https://docs.autonomx.io/quick-start

Reporting

  • Extent Reports is used for BDD style reporting of the test results

alt text

Web Tests

     public static class elements {
            public static EnhancedBy USER_NAME_FIELD = Element.byCss("[placeholder='John Doe']", "username field");
            public static EnhancedBy PASSWORD_FIELD = Element.byCss("#password", "password field");
            public static EnhancedBy LOGIN_SUBMIT = Element.byCss("[type='submit']", "submit button");
            public static EnhancedBy LOGOUT_BUTTON = Element.byCss("[href*='logout']", "logout button");
            public static EnhancedBy MAIN_SITE = Element.byCss(".main-site", "main site button");
            public static EnhancedBy ERROR_MESSAGE = Element.byCss("[class*='InputErrors']", "input errors");

            public static EnhancedBy LOADING_INDICATOR = Element.byCss("[class*='Loading']", "loading indicator");

        }

    
  • Define actions webApp ▸ LoginPanel.java
        /**
      * enter login info and click login button
      * 
      * @param user
      */
     public void login(User user) {
         setLoginFields(user);
         Helper.form.formSubmit(elements.LOGIN_SUBMIT, MainPanel.elements.ADMIN_LOGO, elements.LOADING_INDICATOR);

     }

     public void loginError(User user) {
         setLoginFields(user);
         Helper.form.formSubmit(elements.LOGIN_SUBMIT, elements.ERROR_MESSAGE);
     }

     public void relogin(User user) {
         manager.main.logout();
         login(user);
     }

     public void setLoginFields(User user) {
         Helper.form.setField(elements.USER_NAME_FIELD, user.username().get());
         Helper.form.setField(elements.PASSWORD_FIELD, user.password().get());
     }
  • Define objects

    • autonomx⁩ ▸ ⁨automation⁩ ▸ ⁨src⁩ ▸ ⁨main⁩ ▸ ⁨java⁩ ▸ ⁨module ▸ webApp ▸ user.csv
    • We are going to use the csv file to setup our data. For more info Csv alt text
  • setup test

     @BeforeMethod
     public void beforeMethod() throws Exception {
        setupWebDriver(app.webApp.getWebDriver());
    }

    @Test
    public void validate_user_Login() {
        UserObject user = UserObject.user().withAdminLogin();
        TestLog.When("I login with admin user");
        app.strapi.login.login(user);

        TestLog.Then("I verify admin logo is displayed");
        Helper.verifyElementIsDisplayed(MainPanel.elements.ADMIN_LOGO);

        TestLog.When("I logout");
        app.strapi.main.logout();

        TestLog.Then("I should see the login panel");
        Helper.verifyElementIsDisplayed(LoginPanel.elements.LOGIN_SUBMIT);
    }
    

Service Level Tests

  • https://docs.autonomx.io/service-level-testing

    • Service level testing encompasses any backend, service, api, and database level testing
    • These tests are compromised of: request, response, and verification
    • Since these follow the same template, we have opted for using csv file to write the tests
    • 1 line 1 complete test
    • This allows us to add lots of tests to each csv file, covering large number of permutations
  • Add Test cases in CSV file at apiTestData/testCases

  • Run tests using the runner at apiTestData/runner//apiRunner

  • CSV files will run in parallel

  • Parallel run value can be set at automation/resources/properties.property "parallel_test_count" alt text

Service Code Integration

  • https://docs.autonomx.io/service-level-testing/service-code-integration

  • We can run our service test with the UI based tests

  • There are 2 methods of achieving this goal

    • Creating a service object and calling the service interface directly
    public Response loginWithServiceObject(CommonUser user) {
        
        ServiceObject loginApi = Service.create()
                .withUriPath("/auth/local")
                .withContentType("application/json")
                .withMethod("POST")
                .withRequestBody("{" + 
                        "\"identifier\": \""+ user.username +"\",\r\n" + 
                        "\"password\": \"" +user.password + "\"" + 
                        "}")
                .withOutputParams(
                        "user.role.id:<$roles>;"
                        + "jwt:<$accessTokenAdmin>;"
                        + "user.id:<$userId>");
                
        return RestApiInterface.RestfullApiInterface(loginApi);
    }
    • Creating a service keyword in a csv file and calling the test case name
    public void login(CommonUser user) {
        Service.getToken
                .withUsername(user.username)
                .withPassword(user.password)
                .build();
    }

Script Runner

About

Autonomx provides a complete testing platform for UI (Web, iOS, Android, Win) and API testing. It provides a feature rich and viable testing solution for end to end testing. It's designed to be fast, scalable, reliable and adaptable to any requirements for ever growing projects.

License:MIT License


Languages

Language:Java 100.0%