Giter Site home page Giter Site logo

joe-t-1-31-17-c-jw's Introduction

Joe-T-1-31-17-C-JW

Installation

Execution

  • Using your systems terminal window ensure you are in the same directory as the tests.rb file. Then run it.
  • Terminal: ruby /Users/joe/Desktop/Joe-T-1-31-17-C-JW-master/tests.rb
  • Note: You can choose to run tests in Firefox browser by simply adding the argument at the end like below (chrome is the default if no argument is passed)
  • Terminal: ruby /Users/joe/Desktop/Joe-T-1-31-17-C-JW-master/tests.rb firefox Approach
  • My approach uses the Watir framework to automate going to the BBC.com and searching a query and then validating the expected first 10 results on the page by counting each individual <li> element nested inside the <ol> list of search results (see test_a1 for reference)
  • Using a class variable (@@browser) enabled me to carry on testing further results beyond page 1’s (see test_b2- test_k11). Because the same action and verification occurs on further pages, the tests are dynamic which optimizes code space and allows verification of further result pages beyond to be added with ease. The same verification process that takes place in test_a1 occurs in these tests, they count every individual <li> (result) and checks against our expected results (which is 10 additional results (<li>) each time next page clicked by a user.
  • The final test (test_l12 )uses the results Watir has collected from the tests previously run to parse for occurrences of a predetermined phrase. It then outputs amount it found into the terminal.

Compromises

  • With the exception of the first test, the other tests are reliant on the previous ones for it to run correctly. This is not ideal as a general rule of good tests is that they should be isolated from each other to ensure accuracy.

Future Enhancements

  • Implementation of independent runnable tests, while this may very well add to total runtime it'd likely offer better accuracy of each case.

Test Cases To Be Implemented

  • The test cases present are just parsing and then counting <li> elements on the search page each time a new set of results are loaded. Additional cases in the future should be added to allow for a more accurate verification. Some of these checks could include:
    • Ensure each <li> element is actually visible on the users page (elements can be hidden using clever style methods in CSS, current cases don’t look for this trickery)
    • Ensure the amount of <li> BBC returned is the same as the number present in BBC’s expected amount to be return (BBC’s HTML markup shows an id with an integer count of how many elements should be present in each page load, current unit tests don’t check against this information)
    • Ensure there are no duplicate article listings in the search results (if this a requirement), after all is a search result really considered a new result if it’s already been listed before?

joe-t-1-31-17-c-jw's People

Contributors

joewetton 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.