/testing

Primary LanguageRuby

Cucumber...

Follow if doing from scratch...

  • Install RVM and Ruby

    • Linux

      • follow https://github.com/rvm/ubuntu_rvm
        sudo apt-get install software-properties-common
        sudo apt-add-repository -y ppa:rael-gc/rvm
        sudo apt-get update
        sudo apt-get install rvm
        
        Reboot
        rvm install ruby
        
    • Mac

  • Make a project directory and 'cd' to the new project directory

    mkdir testing
    cd testing
    
  • Install bundler

    gem install bundler
    gem install rubygems-update
    
  • Create a file called Gemfile (Contents of file is below... Bear in mind, the versions may need changing!)

    source 'https://rubygems.org'
    
    ruby '2.5.1'
    
    gem 'cucumber', '3.1.2'
    gem 'rspec', '3.7.0'
    gem 'rspec-expectations', '3.7.0'
    gem 'rake'
    gem 'selenium-webdriver'
    
  • Run bundle install

    bundle install
    
  • Create the directory structure

      . testing                            # top level directory created earlier
      ├── config                           # cucumber configuration
      ├── coderdojo
      |   ├── features                     # feature and scenario definitions (test cases)
      |   ├── pages                        # page object classes
      |   └── step_definitions             # step implementations
      |   └── helpers                      # testing application helper objects  
      ├── sample_files                     # files for uploading from tests
      └── support                          # "framework" hooks for setup/teardown/etc
    
  • Get Selenium browser drivers (Mac & Linux)

    • Firefox
      • Get geckodriver from https://github.com/mozilla/geckodriver/releases for example, you might get geckodriver-v0.21.0-linux64.tar.gz or geckodriver-v0.21.0-macos.tar.gz

      • Uncompress geckodriver-v0.21.0-linux64.tar.gz or geckodriver-v0.21.0-macos.tar.gz

      • Install

        sudo cp geckodriver /usr/bin/.
        sudo chmod 755 /usr/bin/geckodriver
        
    • Chrome
    • Opera
    • Safari (Mac Only)
      • As of 2016, safaridriver is bundled automatically by Apple.
      • Prior to running automation, open Safari and in the Developer menu item, select the Allow Remote Automation option.
  • Write some cucumber! Enjoy!

    Try the example in your top-level project directory, from the terminal, either:

    cucumber coderdojo/features -p desktop_web -p chrome
    cucumber coderdojo/features -p mobile_web -p headless-chrome
    

    or

    cucumber coderdojo/features -p tablet_web -p firefox
    cucumber coderdojo/features -p desktop_web -p firefox -p debug
    

    or

    cucumber coderdojo/features -p mobile_web -p opera
    

    or

    cucumber coderdojo/features -p desktop_web -p safari
    

    or

    cucumber coderdojo/features -p api
    

    or

    cucumber coderdojo/features -p mobile_app_ios
    cucumber coderdojo/features -p tablet_app_ios
    cucumber coderdojo/features -p mobile_app_android
    cucumber coderdojo/features -p tablet_app_android