-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More test coverage, more idiomatic tests #6
Comments
Hi Brian, Yeah, the tests do take a long time. I'm not a testing expert, and I was mostly interested in getting tests written, rather than making them perfect. As such, I'm not married to |
Awesome. Yeah - definitely no criticism intended. Tests > no tests. |
None taken. :) Looking forward to your PR. |
My colleague asks: Can we do minitest instead of rspec? |
Yeah, absolutely. However, I've never used minitest, so I may not be up for On Tue, Jul 23, 2013 at 3:13 PM, Jeremy B. Merrill <notifications@github.com
|
Okay. Rumor has it that they're similar, but I don't really know from experience. How would you, under RSpec, avoid starting the server so often? Perhaps I ought to only test the fetching-related methods with the server on, and the rest should just load the page from disk. (Because then I'm not actually testing stuff that needs teh server.) I'd love to hear your thoughts... |
@brianflanagan, I converted the tests to RSpec in bcaa857; they now run way faster (31sec on my machine). If you have any other ideas on how to improve the tests, please don't hesitate to let me know (or submit a PR). :) |
Fantastic - I'll take a look. Apologies for flaking on this; still intend to submit a pull request or two. |
Awesome, thanks! If you have any RSpec tips wrt to what I wrote, I'm happy to hear them. I'm not a testing expert... |
It's not the test framework that is slow, it's the use of a webserver. At some point, the dependence on Thin should be removed and replaced with Fakeweb to simulate HTTP responses: https://github.com/chrisk/fakeweb The HTML parsed should also be vastly simplified...but totally understandable that it's more comfortable with working with HTML you've looked at many times before. |
+1 There's no need to test |
I have some |
Fakeweb looks awesome. Makes sense to replace my silly Thin stuff with it. As far as simplifying the HTML goes, do y'all suggest bare HTML pages with nothing but the tested element, or just removing the Wikipedia/ProPublica headers, etc. on the test cases and leaving the scraped content mostly the same? |
Yeah...including the full pages makes things slower on two fronts...one, with just the opening and parsing of the pages, and two, for other contributors to read. For example, some of the headlines scraped on the sample pages are repeated (in sidebars and widgets)...if you write the tests with a single purpose, such as: Does Upton use the given selector to find the expected hrefs, then it shouldn't matter what else is on the page. A possible strategy at this time is to move the current full-page tests into their own directory...as you write actual unit tests, those full page tests should still pass (until they don't, whenever you've decided to change the API) |
You all will be pleased to learn that I got rid of that Thin server and used webmocks. :) Removing the extraneous page structure is still tk. |
This maybe isn't an issue, but seems like it should be avoidable. I imagine this should all be fairly straightforward to test without starting and stopping
thin
.Would you be up for an rspec'd pull request?
The text was updated successfully, but these errors were encountered: