[{"user_id": 1101, "stars": [], "topic_id": 2124, "date_created": 1297278917.8928709, "message": "What are the approaches to test web applications? The concept is easier with tools, such as libraries, when you have methods that can operate on something (elements, strings, objects etc.). It's also easier to grasp how to test tools because you can find plenty of tests for different libraries. However, most of the tuts I've found on the web are only explaining how to use different testing frameworks and their APIs but don't actually explain what approach one would take to test an application.", "group_id": 160, "id": 52709}, {"user_id": 1101, "stars": [], "topic_id": 2124, "date_created": 1297279038.7207501, "message": "In an app, you have UI, you have a data model, you have XHRs... Should you test your JS against the actual data coming from the server? Should you create \u201cdummy\u201d objects that match these expected JSON maps from the server? Should one \u201cimitate\u201d user interaction with, say, \u201cfiring\u201d events with fire() or trigger() or whatever?", "group_id": 160, "id": 52825}, {"user_id": 1065, "stars": [], "topic_id": 2124, "date_created": 1297279431.336998, "message": "@gryzzly What I've read is that you mock the XHRs, just return the data the server should", "group_id": 160, "id": 52976}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282873.277602, "message": "test the error condition of the ajax request.", "group_id": 160, "id": 54661}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282585.9538939, "message": "integration testing: Component X works with Component Y, with nothing else involved.", "group_id": 160, "id": 54513}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282603.7204239, "message": "ie: database driver + database would be a good test of this, I think.", "group_id": 160, "id": 54525}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297280955.7099819, "message": "Do you have a particular javascript thing in mind?", "group_id": 160, "id": 53764}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297280902.1643469, "message": "@gryzzly That sounds reasonable. Its a matter of what level of testing you want to do.", "group_id": 160, "id": 53735}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297280961.781697, "message": "Might be easier to talk about something concrete.", "group_id": 160, "id": 53769}, {"user_id": 1101, "stars": [], "topic_id": 2124, "date_created": 1297281379.6479659, "message": "Question is: what levels are there :-) Unfortunately I have no experience in testing, only from reading jQuery and XUI and some jQuery plugins test suites. Let's take a simple example: tabs with forms within them, a button to add new tab, a button that triggers \"save\" action that \"submits\" a form within a selected tab and refreshes when it receives proper response from server (processed object with certain attributes).", "group_id": 160, "id": 54007}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282931.2904561, "message": "many of these are dependant on how you build the app in the first place, tbh.", "group_id": 160, "id": 54695}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282827.78724, "message": "new test: call the callback registered with the XHR with some known data. Make sure that the body of the tab was rendered with the info you expect.", "group_id": 160, "id": 54634}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282855.144701, "message": "test that after a plugin is initialized, click events are where you expect them.", "group_id": 160, "id": 54647}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282531.0854859, "message": "There are unit tests. Its the lowest level of testing.", "group_id": 160, "id": 54491}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282892.92872, "message": "test what happens in the case of an error in the form.", "group_id": 160, "id": 54676}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282563.9695561, "message": "You remove any dependencies from the small code in question (single function) via mocking and test that a given known input corresponds to a known good output.", "group_id": 160, "id": 54504}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282711.8398499, "message": "so to your question..", "group_id": 160, "id": 54583}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282919.1028881, "message": "test that clicking a new tab calls save. (like via events being triggered)", "group_id": 160, "id": 54689}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282702.225641, "message": "There is also functional testing, aka End to End testing. This would be something like. Can I add something in my admin and then see it on a webpage.", "group_id": 160, "id": 54576}, {"user_id": 218, "stars": [], "topic_id": 2124, "date_created": 1297282794.594377, "message": "I would likely do something like: call the save() method. Ensure that the mocked XHR object had its send() method called.", "group_id": 160, "id": 54619}, {"user_id": 1101, "stars": [], "topic_id": 2124, "date_created": 1297283693.3238521, "message": "@justinlilly thanks for advice! I will be trying to take these steps.", "group_id": 160, "id": 55119}, {"user_id": 5042, "stars": [], "topic_id": 2124, "date_created": 1297337547.1924009, "message": "@gryzzly You should look at http://www.amazon.com/Test-Driven-JavaScript-Development-Developers-Library/dp/0321683919 and jsTestDriver utility from Google Code.", "group_id": 160, "id": 68535}, {"user_id": 8282, "stars": [], "topic_id": 2124, "date_created": 1297616118.9517751, "message": "here; http://jsbuild.kodfabrik.com", "group_id": 160, "id": 91990}, {"user_id": 8282, "stars": [], "topic_id": 2124, "date_created": 1297616227.168148, "message": "to don't rewrite two different library separately", "group_id": 160, "id": 92013}, {"user_id": 8282, "stars": [], "topic_id": 2124, "date_created": 1297616104.8380351, "message": "I'm working on a tool compiling commonjs code for web browsers", "group_id": 160, "id": 91988}, {"user_id": 8282, "stars": [], "topic_id": 2124, "date_created": 1297616188.2502861, "message": "and think that we need a common testing approach for both client-side and serverside", "group_id": 160, "id": 92006}, {"user_id": 2106, "stars": [], "topic_id": 2124, "date_created": 1297632138.9975209, "message": "i am usingQUnit for javasript testing http://docs.jquery.com/Qunit", "group_id": 160, "id": 93807}, {"user_id": 1516, "stars": [], "topic_id": 2124, "date_created": 1297679674.498116, "message": "can fake XHR and timers too!", "group_id": 160, "id": 97804}, {"user_id": 1516, "stars": [{"date_created": 1297682111.4916129, "user_id": 2106}], "topic_id": 2124, "date_created": 1297679657.8435791, "message": "Sinon.JS is a great mocking library: http://sinonjs.org/", "group_id": 160, "id": 97795}, {"user_id": 13919, "stars": [], "topic_id": 2124, "date_created": 1298153682.4821329, "message": "Have you checked out JasmimeJS? It works with both node and in the browser making it easy to test code that has to run in both contexts. https://github.com/pivotal/jasmine", "group_id": 160, "id": 150715}, {"user_id": 4935, "stars": [], "topic_id": 2124, "date_created": 1298257944.254993, "message": "@azer: I'm definitely interested. I saw this the other day: https://github.com/substack/node-browserify Similar stuff, done as a middleware.", "group_id": 160, "id": 155840}, {"user_id": 9327, "stars": [], "topic_id": 2124, "date_created": 1298263416.717006, "message": "If you are interested in headless integration testing. Check out http://zombie.labnotes.org/ I have just been playing with it, so far very impressed.", "group_id": 160, "id": 156031}, {"user_id": 1101, "stars": [{"date_created": 1298675725.0815499, "user_id": 9327}, {"date_created": 1298681599.8790691, "user_id": 1516}, {"date_created": 1298890274.888689, "user_id": 2153}], "topic_id": 2124, "date_created": 1298640025.2406271, "message": "for whoever was also interested in the subject: great tutorial here: http://msdn.microsoft.com/en-us/scriptjunkie/gg655487.aspx", "group_id": 160, "id": 207735}, {"user_id": 18757, "stars": [], "topic_id": 2124, "date_created": 1299257611.6508219, "message": "Here is an interesting article on Javascript testing http://msdn.microsoft.com/en-us/scriptjunkie/gg650426.aspx", "group_id": 160, "id": 271150}, {"user_id": 8490, "stars": [], "topic_id": 2124, "date_created": 1299350503.2945149, "message": "Anybody know a way to auto refresh your browser window when doing testing? Having to click the refresh button each time gets kinda annoying after a while.", "group_id": 160, "id": 277161}, {"user_id": 8490, "stars": [], "topic_id": 2124, "date_created": 1299352622.43362, "message": "Asked a question about testing on http://codereview.stackexchange.com/questions/1172/coffeescript-testing-testing-constructor-parameters-for-null", "group_id": 160, "id": 277366}, {"user_id": 8470, "stars": [], "topic_id": 2124, "date_created": 1300909699.528286, "message": "@MarkBennett I've been using JasmineJS and really enjoy it over QUnit, especially being able to run tests headless on Node, but the backtraces are beyond unhelpful. Have you figured out a way around this?", "group_id": 160, "id": 420134}, {"user_id": 13919, "stars": [], "topic_id": 2124, "date_created": 1300979539.953105, "message": "@andrewle I think I'd have to see an example, but I agree the backtraces in general could be clearer. Even being able to specify more helpful failure messages would be useful. What would you do to improve them?", "group_id": 160, "id": 427608}, {"user_id": 8470, "stars": [], "topic_id": 2124, "date_created": 1300985904.0910001, "message": "@MarkBennett I think this I really a limitation of JS though compared to the flexibility of Ruby. But I do think I remember seeing a patch for this in github that I should check out.", "group_id": 160, "id": 428715}, {"user_id": 8470, "stars": [], "topic_id": 2124, "date_created": 1300985810.34622, "message": "@MarkBennett Currently the backtraces point at anonymous functions within Jasmine rather than the line of code in the spec with the failing expectation. While naming your specs well and keeping them small helps, the backtraces should really point at the failing code.", "group_id": 160, "id": 428698}, {"user_id": 13919, "stars": [], "topic_id": 2124, "date_created": 1300988705.2259231, "message": "@andrewle I wonder if using named function expressions might fix this. Going to go try right now...", "group_id": 160, "id": 429029}]