Coder Social home page Coder Social logo

psisysinsight / appium-reporter-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from appiumtestdistribution/appium-reporter-plugin

0.0 0.0 0.0 19.44 MB

Appium2 plugin to generate html report with screenshots.

License: Apache License 2.0

Shell 0.25% JavaScript 83.73% CSS 13.27% HTML 2.76%

appium-reporter-plugin's Introduction

appium-reporter-plugin

example workflow

Intro

appium-reporter-plugin is appium 2.0 plugin, for generating simple html report with screenshots. Consolidated Report is generated for all the test that ran in the appium session. Report can be fetched from server and be written to file (just like screenshots).

When to use

appium-reporter-plugin would be handly, if you need to

  • Take screenshot at every step of your test (not just at test failure / end)
  • Generate a simple standalone html report with screenshots

Sample Report Demo

actual-plugin-720.mov

How to use

To install plugin

appium plugin install --source=npm appium-reporter-plugin

Start appium server with plugin

appium --use-plugins=appium-reporter-plugin

Sample implementation can be found in test/demo/demo.spec.js and test/demo/base.js

Mappings / Commands

appium-reporter-plugin assumes every test/spec uses new driver session. For commands invoked on the driver session, screenshot and metrics are captured at server side. At the end of the test i.e., before deleting the driver session, session/${sessionId}/setTestInfo should be called to map test information. After all the tests are completed /getReport can be called to fetch the html report and written to file. To clear the test info stored on the server, /deleteReportData can be used.

setTestInfo

For mapping test information to data collected, server binding POST: /session/:sessionId/setTestInfo is exposed. This binding accepts JSON payload with keys as mentioned below

key Description Type Accepted Values
testName Name of the test Mandatory any string
testStatus Test execution status Mandatory PASSED, FAILED
error Reason for test Failure Optinal any string

ex:

    {testName: 'Sum of 1 and 2 should be 3', testStatus: 'PASSED'}
    {testName: 'Sum of 1 and 2 should be 4', testStatus: 'FAILED', error: 'Sum of 1 and 2 is 3'}

getReport

After execution of all the tests, report can be downloaded from server using GET: /getReport. getReport returns a html report with screenshots as a string.

deleteReportData

screenshots and test information is stored on server and this occupies space. To clear the space and delete all the test infomation on server DELETE: /deleteReportData can be used.

-- demo.spec.js has working example and we recommamd checking the implementation.

Note:

  1. appium-reporter-plugin doesn't gather test results data from any unit test framework.
  2. Bindings exposed by this plugin are not default W3C binding, hence these commands can't be drirecly called on driver object. Either wdio setCommand should be used or direct api call can be made.

Build

npm run build

Install from code base

1. set APPIUM_HOME to a local directory and install drivers needed
 export APPIUM_HOME=~/Documents/AppiumTestDistribution/appium-reporter-plugin/local_appium_home

2. npm run install-plugin

Re-Install from code base

npm run reinstall-plugin

Start appium server with plugin

appium --use-plugins=appium-reporter-plugin

Run tests

npm run test

Note : If you are overriding APPIIM_HOME make sure drivers are installed

appium driver install xcuitest
appium driver install uiautomator2

ToDo

  • explore event timing apis
  • Add details such as - sessionId overall timing of test number of android and ios
  • expose the exclusion command list
  • expose screenshot resize params as arguments
  • githooks for lint and pretty

appium-reporter-plugin's People

Contributors

dileep17 avatar dependabot[bot] avatar harsha-salim 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.