Coder Social home page Coder Social logo

quiz_with_ajax_saves's Introduction

Quiz_With_Ajax_Saves

All done. The look is not polished as CSS is not my forte and not my goal here.

Saving user scores and top scores to files. Quiz is all done with Qunit testing and saving of scores to files. Now that I have finished, I can reflect on things I would do differently, specifically with Qunit.

While I like Qunit for testing of functions and methods, I had to manipulate it more to test the UI. QUnit is meant for atomic testing (as unit testing should be). However, I needed to test how a user would move through the quiz. This involved tests which depend on the state created by the previous state. It would have been possible to do some setup inside of each test to move the application into the correct state for each test, but that would have added a lot of code to each one and would have been prone to errors in itself. My solution was to save the state of the #qunit-fixture after the test was complete (but within the test function) to a global variable. I could then use this state as the setup for the next consecutive tests by inserting into the html page. Thus, the next test could continue on with the flow of the program. It may not be the most elegant solution, but it worked pretty well and the app was pretty much working correctly when I ran it (minus some spots I missed in testing). Still, I feel like there is a better way out there to test UI. It shall have to be researched.

I should have created tests for the back end itself. By doing that and so knowing they work correctly, I could have mocked my ajax calls and not had to reset my data after running the tests.

Overall, after reading a post on the Fluencia engineering blog, Mocha, Chai, and Sinon seem very interesting. I will probably look to using them for when this is converted to node and backbone.

quiz_with_ajax_saves's People

Contributors

rkotenko avatar

Watchers

James Cloos avatar  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.