/TheOneFramework

Web, Mobile and Api Automation using Selenide, Rest Assured, Junit5 and Allure

Primary LanguageJava

SonarCloud

Selenide + Rest Assured + Junit5 + Allure for Web, Mobile,and Api Automation

One single framework to automate web, mobile and api.

Preferred Java Version : JDK-11

Libraries Used:

  1. Selenide for web and mobile automation
  2. Rest Assured for Api automation
  3. Junit5 as testing framework
  4. Allure for reporting
  5. Owner for properties file management
  6. Lombok to avoid boilerplates
  7. PODAM for test data generation
  8. Java Faker for random data
  9. AssertJ for fluent assertion of Api

Video tutorials

Selenide

Selenide-Appium

Rest-Assured

SDET Essentials playlist

Sample Web Test

@SmokeTest
class AddEmployeeTest extends WebTestSetup {

  private final EmployeeDetails employeeDetails = EmployeeTestData.getRandomEmployeeDetails();
  private final LoginDetails loginDetails = LoginTestData.getValidLoginDetails();

  @WebTest
  void testAddEmployee() {
    LoginPage.getInstance()
        .loginToApplication(loginDetails)
        .navigateToEmployeeInformationPage()
        .addNewEmployee(employeeDetails)
        .checkWhetherEmployeeCreatedSuccessfully();
  }
}

Sample Mobile Test

@RegressionTest
class AddToCartTest extends MobileTestSetup {

    @MobileTest
    void addAProductToCart() {
        ProductDetailsScreen productDetailsScreen = screen(ProductDetailsScreen.class);
        productDetailsScreen
                .selectProduct()
                .checkWhetherAddToCartButtonIsPresent();
    }
}

Sample Api Test

@RegressionTest
class CreateUserTest extends ApiTestSetUp {

    private final UserDetails userDetails = UserTestData.getUserDetails();

    @ApiTest
    void createUser() {
        Response response = CreateUserApi.createUser(userDetails);

        assertThat(response)
                .statusCodeIs(201)
                .canBeDeserializedTo(CreateUserResponse.class)
                .hasKeyWithValue("job", userDetails.getJob())
                .andMatchingRule(e-> e.jsonPath().getString("name").equalsIgnoreCase(userDetails.getName()))
                .matchesSchemaInFile("create-user-response-schema.json")
                .assertAll(); //don't forget to call assertAll
    }
}

To run web tests:

mvn clean test -Dgroups=web -Dselenide.browser=chrome

mvn clean test -Dgroups=web -Dselenide.browser=firefox

To run mobile tests:

Local-Android | mvn clean test -Dgroups=mobile -Dselenide.browser=com.tmb.provider.mobile.local.AndroidAppProvider

Local-Ios | mvn clean test -Dgroups=mobile -Dselenide.browser=com.tmb.provider.mobile.local.IosAppProvider

Lambda-Test-Android

  • To run your native android app test utilizing a real device on LambdaTest cloud, upload the sample android apk from here using the LambdaTest app upload api. This will give you app_url in response which we need to set for lambdaTestAppUrl in config.properties
  • Add your Lambdatest username and accessKey in config.properties or pass it as system property
  • Run below command:

mvn clean test -Dgroups=mobile -Dselenide.browser=com.tmb.provider.mobile.remote.LambdaTestAndroidAppProvider -DlambdaTestAppUrl=lt://APPURL12345

To run api tests:

API - mvn clean test -Dgroups=api

To generate allure report after execution

Install Allure in the machine - brew install allure

Open allure reports - allure serve ./target/allure-results