Code Monkey home page Code Monkey logo

circleci-javademo's Introduction

CircleCI-JavaDemo

CircleCI

This project shows how to integrate CircleCI with your Perfecto lab on the cloud and getting tests report with Perfecto DigitalZoom Reporting.

Getting Started:

  • Use git clone or download the project and customize your test within the RemoteWebDriverTest class:
reportiumClient.testStart(TestName, new TestContext(platformName, platformVersion, browserName));

reportiumClient.testStep("Open google"); // testStep
driver.get("https://www.google.com/");

reportiumClient.testStep("Search PerfectoCode"); // testStep
driver.findElement(By.name("q")).sendKeys("PerfectoCode");

/**
* Complete your test here ...
*/
  • Importent! set the following environment variables in order to connect Perfecto Lab via CircleCI machine:
// Set cloud host and credentials values from CI, else use local values
String PERFECTO_HOST = System.getenv("PERFECTO_HOST");
String PERFECTO_USER = System.getenv("PERFECTO_USER");
String PERFECTO_PASSWORD = System.getenv("PERFECTO_PASSWORD");

For more information about this step see CircleCI documentation here.

DigitalZoom Reporting:

For the complete documentation of Perfecto DigitalZoom Reporting click here.

  • The Utils class include the ReportingClient construction as the below code snippet:
public static ReportiumClient createReportiumClient(RemoteWebDriver driver, String ... tags ){

    // See: https://circleci.com/docs/1.0/environment-variables/
    // for the complete CircleCI env variables guide
    String projectName = System.getenv("CIRCLE_PROJECT_REPONAME");
    String projectNumber = System.getenv("CIRCLE_BUILD_NUM");
    String jobName = System.getenv("CIRCLE_PROJECT_REPONAME");
    int jobNumber = Integer.parseInt(System.getenv("CIRCLE_BUILD_NUM"));

    PerfectoExecutionContext perfectoExecutionContext = new PerfectoExecutionContext.PerfectoExecutionContextBuilder()
            .withProject(new Project(projectName, projectNumber))
            .withJob(new Job(jobName, jobNumber))
            .withContextTags(tags)
            .withWebDriver(driver)
            .build();

    return new ReportiumClientFactory().createPerfectoReportiumClient(perfectoExecutionContext);
}

In the presented method we are using System.getenv(...) in order to require from CircleCI the Project name and build number.

  • In order to get the complete test report for tests within the same job (In RemoteWebDriverTest class):
    Note! This step require to set first the REPORTING_SERVER env variable within CircleCI configuration. For more information about your Reporting server see here.
@AfterClass
public void afterClass(){
    String host = System.getenv("PERFECTO_HOST"); // Your PerfectoLab host
    String serv = System.getenv("REPORTING_SERVER"); // Reporting server
    String jobn = System.getenv("CIRCLE_PROJECT_REPONAME"); // Job name
    String jobv = System.getenv("CIRCLE_BUILD_NUM"); // Job number

    System.out.println("=================================================================");
    System.out.println("See the complete report at: ");
    System.out.println("https://" + host + "." + serv + ".perfectomobile.com/?jobName[0]=" + jobn + "&jobNumber[0]=" + jobv);
    System.out.println("=================================================================");
}

circleci-javademo's People

Contributors

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