Optimus

Optimus

  • Getting Started
  • Docs
  • Reporting
  • Roadmap
  • Contributors
  • Github

›Setting Up New Project

Getting Started

  • Getting Started

Installation

  • Optimus Cloud Installation

Setting Up New Project

  • Getting Started With TestNG
  • Getting Started With Cucumber
  • Getting Started With PyTest

Integration

  • TestNG Integration

Example Projects

  • Java Example Projects

Terminologies

  • Terminologies

Architecture

  • Bird View

Cucumber

Create a new project

Create a new java “Gradle” project or update existing project with below dependencies

Gradle:

plugins {
    id 'java'
    id "com.testvagrant.optimuscloud.plugin" version "1.0.0"
}

group 'com.testvagrant.optimuscloud'
version '1.0.0'

sourceCompatibility = 1.8

//Execution rules
tasks.runDistribution.dependsOn 'clean', 'build','reserveBuild'
tasks.build.mustRunAfter 'clean'
tasks.reserveBuild.mustRunAfter 'build'
tasks.runDistribution.finalizedBy 'unReserveBuild'
tasks.unReserveBuild.finalizedBy 'distributionReport'

repositories {
    mavenCentral()
}

optimus {
    glue = "com.testvagrant.optimuscloud.steps"
    classpath = sourceSets.test.runtimeClasspath
    tags = System.getProperty("tags", "not @wip")
}

project.ext.cukeversion = "4.8.1"

dependencies {
    implementation "io.cucumber:cucumber-java:${project.cukeversion}"
    implementation "io.cucumber:cucumber-java8:${project.cukeversion}"
    implementation "io.cucumber:cucumber-junit:${project.cukeversion}"
    implementation "io.cucumber:cucumber-core:${project.cukeversion}"
    implementation "io.cucumber:cucumber-picocontainer:${project.cukeversion}"
    implementation "com.testvagrant.optimuscloud:java-client:1.0.0"
    implementation "com.testvagrant.optimuscloud:optimus-monitor:1.0.0"
    implementation "com.testvagrant.optimuscloud:cucumber-dashboard:1.0.0"

    testImplementation "junit:junit:4.12"
}

Write first feature

Create a new feature file

Feature: SayHello
  Just saying hello

  @test
  Scenario: How to say hello
    Given i say hello

Create an entity class for driver management

public class Entity {

    private MobileDriverDetails mobileDriverDetails;

    public MobileDriverDetails getMobileDriverDetails() {
        return mobileDriverDetails;
    }

    public void setMobileDriverDetails(MobileDriverDetails mobileDriverDetails) {
        this.mobileDriverDetails = mobileDriverDetails;
    }
}

Create a base step definition

public class BaseSteps {

    protected AppiumDriver mobileDriver;

    public BaseSteps(Entity entity) {
        this.mobileDriver = (AppiumDriver) entity.getMobileDriverDetails().getMobileDriver();
    }
}

Create a step definition

public class HelloSteps extends BaseSteps {

    public HelloSteps(Entity entity) {
        super(entity);
    }

    @Given("^i say hello$")
    public void iSayHello() throws InterruptedException {
        String welcomeMessage = mobileDriver.findElement(By.id("welcome_message")).getText();
        Assert.assertEquals(
                welcomeMessage,
                "Welcome to Optimus!! You are all ready to experience Automation like never before."
        );
        Assert.assertTrue(false);
    }
}

Implement @Before and @After hooks

public class StartingSteps  {


    private Entity entity;
    public StartingSteps(Entity entity) {
        this.entity = entity;
    }

    @Before
    public void setup(io.cucumber.core.api.Scenario cucumberScenario) throws MalformedURLException, URISyntaxException {
        DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
        desiredCapabilities.setCapability("appPackage", "com.testvagrant.hellooptimus");
        desiredCapabilities.setCapability("appActivity", "com.testvagrant.hellooptimus.MainActivity");
        desiredCapabilities.setCapability("app", "https://github.com/testvagrant/OptimusCloud/releases/download/v1/HelloOptimus.apk");
        desiredCapabilities.setCapability("platformName", "Android");
        desiredCapabilities.setCapability("newCommandTimeout", "3600");
        MobileDriverDetails mobileDriverDetails = new OptimusCloudDriver().createDriver(desiredCapabilities);
        entity.setMobileDriverDetails(mobileDriverDetails);
    }


    @After
    public void tearDown(Scenario scenario) {
        new OptimusCloudManager().releaseSession(entity.getMobileDriverDetails());
    }
}

Run

./gradlew runDistribution -Dtags=@test

Dashboard

Navigate to http://localhost:9901 and login with credentials creds: u: admin, p: C0mplexPwd. You will be able to see optimus dashboard.

Build History

Dashboard Homepage

TestDetails Report

Test Details

Non Functional Report

NFR

← Getting Started With TestNGGetting Started With PyTest →
  • Create a new project
  • Write first feature
    • Create a new feature file
    • Create an entity class for driver management
    • Create a base step definition
    • Create a step definition
    • Implement @Before and @After hooks
  • Run
  • Dashboard
    • Build History
    • TestDetails Report
    • Non Functional Report
Optimus
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Facebook Open Source
Copyright © 2020 TestVagrant Technoligies