This project shows how to integrate CircleCI with your Perfecto lab on the cloud and getting tests report with Perfecto DigitalZoom Reporting.
- Use git clone or download the project and customize your test within the RemoteWebDriverTest class:
reportiumClient.testStart(TestName, newTestContext(platformName, platformVersion, browserName));
reportiumClient.testStep("Open google"); // testStepdriver.get("https://www.google.com/");
reportiumClient.testStep("Search PerfectoCode"); // testStepdriver.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 valuesStringPERFECTO_HOST = System.getenv("PERFECTO_HOST");
StringPERFECTO_USER = System.getenv("PERFECTO_USER");
StringPERFECTO_PASSWORD = System.getenv("PERFECTO_PASSWORD");For more information about this step see CircleCI documentation here.
For the complete documentation of Perfecto DigitalZoom Reporting click here.
- The Utils class include the ReportingClient construction as the below code snippet:
publicstaticReportiumClientcreateReportiumClient(RemoteWebDriverdriver, String ... tags ){
// See: https://circleci.com/docs/1.0/environment-variables/// for the complete CircleCI env variables guideStringprojectName = System.getenv("CIRCLE_PROJECT_REPONAME");
StringprojectNumber = System.getenv("CIRCLE_BUILD_NUM");
StringjobName = System.getenv("CIRCLE_PROJECT_REPONAME");
intjobNumber = Integer.parseInt(System.getenv("CIRCLE_BUILD_NUM"));
PerfectoExecutionContextperfectoExecutionContext = newPerfectoExecutionContext.PerfectoExecutionContextBuilder()
.withProject(newProject(projectName, projectNumber))
.withJob(newJob(jobName, jobNumber))
.withContextTags(tags)
.withWebDriver(driver)
.build();
returnnewReportiumClientFactory().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 theREPORTING_SERVERenv variable within CircleCI configuration. For more information about your Reporting server see here.
@AfterClasspublicvoidafterClass(){
Stringhost = System.getenv("PERFECTO_HOST"); // Your PerfectoLab hostStringserv = System.getenv("REPORTING_SERVER"); // Reporting serverStringjobn = System.getenv("CIRCLE_PROJECT_REPONAME"); // Job nameStringjobv = System.getenv("CIRCLE_BUILD_NUM"); // Job numberSystem.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("=================================================================");
}