ReportPortal With Selenium, TestNG

What is ReportPortal?

ReportPortal is a service, that provides increased capabilities to speed up results analysis and reporting through the use of built-in analytic features.
ReportPortal is a great addition to the Continuous Integration and Continuous Testing process.
Follow: http://reportportal.io/documentation/documentation.html?n=1045



Installation steps

Download and install Docker (Docker Engine, Compose, etc)

Download link for windows 7: https://github.com/docker/toolbox/releases (Recommended DockerToolbox-18.09.3.exe)

NOTE: Make sure to install VirtualBox to support docker, compose engines in window machines.

Deploy ReportPortal

ReportPortal can be easily deployed using Docker-Compose.
  1. Make sure the Docker (EngineCompose) is installed.
  2. Download the latest compose descriptor example from here. You can make it by the next command:
    curl https://raw.githubusercontent.com/reportportal/reportportal/master/docker-compose.yml -o docker-compose.yml
  3. Start the application using the following command:
         docker-compose -p reportportal up -d --force-recreate

   1. Open your browser with the IP address of the deployed environment at port 8080
  1. http://IP_ADDRESS:8080
  2. Ex: http://192.168.99.100:8080
  3. NOTE: IP Address will provide in the Docker toolbox by defaultly.
  4. 2. Use next login\pass for access:
  5. default\1q2w3e or superadmin\erebus

Maven Project Setup With ReportPortal

  1. Use Any Existing Maven Proejct
  2. Add Below dependencies to the POM
<repositories> <repository> <snapshots> <enabled>false</enabled> </snapshots> <id>bintray-epam-reportportal</id> <name>bintray</name> <url>http://dl.bintray.com/epam/reportportal</url> </repository> </repositories> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.4.0</version> </dependency> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.7</version> </dependency> <dependency> <groupId>com.epam.reportportal</groupId> <artifactId>agent-java-testng</artifactId> <version>4.2.1</version> </dependency> <!-- TODO Leave only one dependency, depends on what logger you use: --> <dependency> <groupId>com.epam.reportportal</groupId> <artifactId>logger-java-logback</artifactId> <version>4.0.0</version> </dependency> <dependency> <groupId>com.epam.reportportal</groupId> <artifactId>logger-java-log4j</artifactId> <version>4.0.1</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.2.3</version> </dependency> </dependencies>
3. Create a reportportal.properties and include below props
rp.endpoint = http://192.168.99.100:8080
rp.uuid = 10c15fc8-b97b-4e24-877f-2318144f96be rp.launch = superadmin_TEST_EXAMPLE rp.project = superadmin_personal

  Where, Get uuid from " profiles " from reportportal
             Endpoint = Give your local reportportal URL

 4. Create log4j file and include

         <?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
 <Appenders>
  <Console name="ConsoleAppender" target="SYSTEM_OUT">
   <PatternLayout
    pattern="%d [%t] %-5level %logger{36} - %msg%n%throwable"  />
  </Console>
  <ReportPortalLog4j2Appender
   name="ReportPortalAppender">
   <PatternLayout
    pattern="%d [%t] %-5level %logger{36} - %msg%n%throwable" />
  </ReportPortalLog4j2Appender>
 </Appenders>
 <Loggers>
  <Root level="DEBUG">
   <AppenderRef ref="ConsoleAppender" />
   <AppenderRef ref="ReportPortalAppender" />
  </Root>
 </Loggers>
</Configuration>

5. Add a listener in a class level
Ex:
@Listeners({ReportPortalTestNGListener.class}) public class ReportPortalExample {
         }

6. Run a class with TestNG and see the results in your local reportPortal url.

Comments

Popular posts from this blog

Appium - Getting android app Package name and appActivity

Native Apps - Inspect elements by using UI Automator Viewer and Appium Desktop Inspector