Giter VIP home page Giter VIP logo

fullstack-course1-module3-blackbox-testing's Introduction

What is this?

This repo is a small, but working POC (Proof of Concept) of how we might accomplish "Blackbox testing"

Watch the video about Blackbox Testing that uses this repo

https://www.coursera.org/learn/ruby-on-rails-intro/lecture/RbJIe/blackbox-testing

How do we blackbox-test a webapp (Rails or any webapp really) using Ruby? (And why should we use Ruby for this?)

Enter RSpec + Capybara ruby gems. When these 2 frameworks come together, you can write very intuitive and expressive tests.

For example, can you tell what the following test does?

describe "Recipes App" do
  it "displays chocolate by default" do
    visit "/"
    expect(page).to have_content 'Chocolate Tea'
  end

  it "displays beef when keyword is beef" do
    visit "?keyword=beef"
    expect(page).to have_content 'Delicious Scalloped Potato'  	
  end
end

##How do I get started?

  1. Install PhantomJS (http://phantomjs.org/)
  2. Run the following inside your terminal:
$ gem install rspec
$ gem install selenium-webdriver
$ gem install capybara
$ gem install poltergeist
  1. (If you are using rbenv, also run $rbenv rehash)

  2. Pull down this repo

  3. Run the following in your terminal (right outside of spec dir):

    $ rspec

    or even better

    $ rspec -f d

    to see the magic.

Headless mode

# Capybara.default_driver = :selenium
# Headless
Capybara.default_driver = :poltergeist

fullstack-course1-module3-blackbox-testing's People

Contributors

kalmanh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fullstack-course1-module3-blackbox-testing's Issues

Phantomjs failure on win10. "Cliver::Dependency::Not Found"

I followed the steps in the videos to do the blackbox-testing for "my_first_app". However, failures were encountered (shown as below).

I have installed Phantomjs and add the path to environment variables. As a result, I am able to check the version of it.

But when running "rspec", it showed an error that

"Cliver::Dependency::NotFound:

Could not find an executable at given path 'c:/Program Files/phantomjs-2.1.1-windows/bin/phantomjs.EXE'.If this path was not specified explicitly, it is probably a bug in Cliver."

2016-12-08_1-42-39
2016-12-08_1-54-15

I was wondering whether it's an issue of the version of phantomjs I use (2.1.1) or something else. If it is, how can I backtrack to a previous version?

Thanks.

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.