Giter Site home page Giter Site logo

rajdeepv / nakal Goto Github PK

View Code? Open in Web Editor NEW
24.0 5.0 3.0 512 KB

A tool for Automated visual regression testing of android and iOS apps

Home Page: http://rajdeepv.github.io/automation/testing/2015/07/05/automated-visual-regression-of-mobile-apps-using-nakal.html

License: MIT License

Ruby 100.00%

nakal's Introduction

Build Status

Nakal

Automated visual testing of Android/iOS applications.

Nakal is used to add visual validations in your existing test framework (using appium or calabash etc).

Installation

You need to install imagemagick on your machine

Add this line to your application's Gemfile:

gem 'nakal'

And then execute:

$ bundle

Or install it yourself as:

$ gem install nakal

Usage

If you are using cucumber, include following Lines in your env.rb

require "nakal/cucumber"
Nakal.platform = :android

for ios, set:

Nakal.platform = :ios

and then put this line in your automation code, at all places where a new screen loads:

diff_metric = nakal_execute("current_screen_name")

Now, execute your test by passing env variable NAKAL_MODE=build to build the baseline images. All baseline images will be stored in baseline_images folder in current directory

once baseline is built, next execution onwards, start using environment variable NAKAL_MODE=compare to compare against baseline. any difference will be put in the same directory with image file named "current_screen_name_diff.png"

If You want to organize baseline nicely, you can even specify sub-paths in #nakal_execute like this:

diff_metric = nakal_execute("feature/sub_feature/current_screen_name")

For setting custom directory, use:

Nakal.directory= "<desired_directory>"
Nakal.device_name = "nexus7"

For cropping the notification bar OR scroll bar, create a config/nakal.yml file in execution directory.

eg:

put these contents in your nakal.yml file inside config/nakal.yml

samsung_galaxy_s3:
 top: 50
 right: 18
 left: 0
 bottom: 0
 screen_name_to_be_masked: {mask_region: [66,424,340,478]}
 feature/sub_feature/current_screen_name: {mask_region_1: [66,424,340,478],mask_region_2: [76,524,440,578]}

nexus7:
 top: 74
 right: 20
 left: 0
 bottom: 0

iPhone_5s:
 top: 30
 right: 6
 left: 0
 bottom: 0
 screen_name_to_be_masked: {mask_region: [66,424,340,478]}
 feature/sub_feature/current_screen_name: {mask_region_1: [66,424,340,478],mask_region_2: [76,524,440,578]}

Note

  1. There is implicit wait of 30 sec until current screen matches baseline. This timeout can be changed by setting:

     Nakal.timeout = new_timeout_value
    
  2. you can specify the areas of a screen you want to mask/ignore while comparing in nakal.yml as below:

     samsung_galaxy_s3:
      top: 50
      right: 18
      left: 0
      bottom: 0
      screen_name_to_be_masked: {mask_region_1: [66,424,340,478],mask_region_2: [76,524,440,578]}
    
  3. If you want to set certain threshold while comparing. You can pass option as:

     diff_metric = nakal_execute("current_screen_name",{:acceptable_diff => "#{your_acceptable_diff_metric}".to_f})
    

Contributing

  1. Fork it ( http://github.com//nakal/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

nakal's People

Contributors

rajdeepv avatar richaagr avatar

Stargazers

Shining Chen avatar Marcel Veselka avatar  avatar Richard Huang avatar MasterLaw avatar Shridhar Kalagi avatar bruno batista avatar Rohit S. avatar Praveen avatar Cristian Gómez avatar PTeng avatar Daniel Schmidt avatar Michael Wagner avatar Veit Lehmann avatar Björn Brauer avatar David Luu avatar Srinivasan Sekar avatar Akash Gupta avatar  avatar Leonardo R.O. avatar Ajit Singh avatar Sai Krishna avatar Dave Sibiski avatar shane51 avatar

Watchers

James Cloos avatar  avatar  avatar Marcel Veselka avatar Michele Lanning avatar

nakal's Issues

Feature Request -- Per Image Mask Params

The current masking has only device-type params configured once.

In our case we have an area of the screen that contains temporal information we would like to mask out for only one test.

It would be nice if we could specify an "imagename.yml" file next to the baseline image to mask out additional areas beyond the global.

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.