Noel Rappin Writes Here

Rails Test Prescriptions

Hey, I have a blog

Rails Test Prescriptions, self promotionNoel RappinComment

Making me happy

One of the things I want to do in 2015 is write more. This, like all New Year's type resolutions, is invariably doomed, but we'll take it as it comes. I also want to write more about things that aren't programming, because, well, there are a lot of things that aren't programming but are still interesting to write about.

Combining these ideas, I'm going to try (and probably fail) to do a weeklyish "What's making me happy this week" blog post based loosely on the similar feature at the end of the NPR Pop Culture Happy Hour Podcast. That’s, of course, not this post. But the first one is coming.

But first, a word from our sponsor

It's been a while since I did a flat-out update post. So here is one.

The book, by which I mean Rails 4 Test Prescriptions is out. In print, in an actual physical object that has been read by stuffed monkeys across this great planet of ours. And also a few people.

Couple things:

The book is, of course, available from Pragmatic. You can also get it from Amazon. And, unlike the previous version, you can buy the Kindle edition directly from Amazon, if, for some reason that's the only ebook version you want.

As part of what might, if you squinted at it hard enough, be called a marketing push, I was a guest on both the Ruby Rogues and Code Newbie podcasts. Happily enough, I repeat myself almost zero times between the two of them because the discussions went off in completely different directions. Also, the Code Newbie podcast is worth listening to even if you aren't a Code Newbie, and Saron is amazingly organized and putting together something really neat.

I also was lucky enough to be a guest chef for two episodes of Ruby Tapas. This isn't really part of any marketing push except coincidentally. Avdi was looking for a number of guests to help with his schedule as his family was gaining a new baby. They were fun to do, and I'm thinking about ways to distribute other screencasts if I can find the time to do some.

Oh, and according to the PragPub magazine, Rails 4 Test Prescriptions was the top selling book at Pragmatic in December, which I am putting here because someday I'll read this and it will make me happy. I will say a) this is a little bit less impressive than you might think, since Pragmatic only put out a couple of new titles in December, b) it's probably less books than you think, and c) I'm still a little too happy about this -- the first version of the book never got higher than 4th, and I wasn't really expecting any better this time around.

The relative sales between the two versions are actually kind of interesting. The comparison dates aren't quite exact (version one went on sale as a beta in April, and I think they started taking orders at the end of the following February, version two hit beta this June and shipped in December).

So, we're talking about April-Dec 2009 for the first book and June-Dec 2014 for the second. Although this is an extra couple of months for the first book, some of the first book's biggest moths were Feb/Mar 2010 and aren't counted here. So it's not really an apples to apples comparison.

Ebook sales for the two versions are almost identical (the first book is a hair higher). The physical book sales are a lot less this time around -- even though all the physical book sales being counted for the first book would have been pre-orders. For the first version, Ebooks outsold physical books about 6 to 1, this time around it's more like 17 to 1. (Though I expect that ratio to drop back down once Amazon and other bookstore sales get counted). Overall, sales are about 90% ish of the first version through December.

Coming up

I have a few conference and meetup talks coming up.

I'll be doing a talk entitled "What we talk about when we talk about testing" at both a Chicago Ruby North Shore meetup on February 7, and then again at Groupon Geekfest March 3.

I'll be at Ancient City Ruby March 25-27, doing two things. On March 25, I'll be doing what is, I think, iteration 4 of the "How to do Fancy Object Things in Rails Without Losing Your Mind" full-day work shop (not it's actual title). And then sometime during the conference itself I'll be giving a talk on estimation, and Trust-Driven development. Really looking forward to this one.

Oh, and the books

There are two things that you might have given me money for and still be expecting some content. Let's take them one at a time.

Trust-Driven Development

Status: was about 30-40 percent done when I abandoned it to start Rails 4 Test Prescriptions.

I've picked this back up. I was really hoping this would be done by the time Ancient City Ruby comes around. I think it's got a fair shot of getting there.

In retrospect, I may have overestimated the audience for people reading my rants about projects. However, I really like writing it, and I think it's got good advice. So you should read it.

Ember

Status: First edition finished. I promised I'd take another swing once HTMLBars came in and Ember Data hit 1.0, which I was hoping would be roughly August 2014.

Well, HTMLBars will officially be in Ember as of a week or two from now, Ember Data may well actually hit 1.0 some day, plus we've got a whole new suite of tools in Ember CLI, which also now brings in EC6 language features.

My probably ambitious goal is a redo of the whole book, top to bottom, using Ember CLI, EC6, and other cool new stuff to build an application. So it'll be almost 100% new, and probably under the more direct title Master Space and Time With Ember.

Existing owners will get it for free. I'm not sure what will happen to the other MSTWJS books or how I might bundle them.

I'm also not sure when I will start, though it probably will wait until Trust-Driven Dev finishes.

Rails 4 Test Prescriptions Beta Day!

Rails Test PrescriptionsNoel RappinComment

It’s book day! Rails 4 Test Prescriptions is available for Beta purchase today. Tell your friends, tell your enemies, tell random strangers on the street.

I realize this is way more exiting for me than for you, but still… Here are some things that you might want to know:

How do I buy it?

Right now, the only place to buy the book is at the pragmatic website, http://pragprog.com/book/nrtest2/rails-4-test-prescriptions. You can buy it in electronic format, for $25 you get the current book and all future updates in ePub, Mobi (Kindle), and PDF formats. You can bundle the ebook with a pre-order of the physical book for $48, which is a $15 discount over buying them separately.

The print version will be available on Amazon and other outlets when it ships. There is a slight possibility that the Kindle version will also be available at Amazon. Other electronic formats will only be available via the Pragmatic website.

What happens next?

The initial beta of the book is about 2/3 of the final text. (If you look at the Table of Contents on the Pragmatic Site, it’s everything up to and including Integration Testing.

According to the current schedule, I’m due to submit the final draft of the book toward the end of July. I’d expect there to be probably three more betas during that time period. After that, the book goes to a final technical review, then copy edit and production. I think the normal practice, there’s a beta after the technical review, and another one after production.

Then it goes to an actual printer, with a current shipping date, according to the Pragmatic website, of October 10.

What’s in the book?

You can see the full table of contents and read a few excerpts at the web site. Almost all of the book has been rethought and re-written for the new edition. We’ve got Minitest 5, we’ve got up to the minute RSpec 3 changes. We’ve got Capybara, we’ve got Cucumber. We’ve got mocks, and models, and SWIFT tests, and all kinds of great stuff.

The next beta will add security testing, and either JavaScript or external service testing.

I really hope you like this. Tell everybody!

All Things Test Prescriptiony

Rails Test PrescriptionsNoel Rappin4 Comments

A lot of Test Prescription book news got finalized last week.

  • The title of the book is Rails 4 Test Prescriptions: Keeping Your Codebase Healthy. The publisher wanted the Rails version number in the name, and I want the publisher to be happy.
  • The tentative on-sale date for the beta is June 11. For those of you who were around last time, the beta period is expected to be much shorter. It will include 10 1/2 - 11 1/2 chapters out of 16 planned. My guess, backed up by nothing at all, is that we’ll be draft complete about 6 weeks after that and the print version will be another 6-8 weeks after. All that is subject to change.
  • There’s a cover. I think. I hope to be able to show it soon.
  • Meantime, I’m on a pretty strict 3-4 pages a day to get to the beta deadline.

Here are the changes, broadly speaking, between the first edition and the second. Very nearly all the book has been rewritten at least slightly, there’s almost no text that was copied over without any changes. But it goes a lot further than that. I’m quite confident that if you own the original version, you will find most of this new.

  • All tools upgraded to latest versions: Rails 4.1.x, Minitest 5.3.x, RSpec 3, and so on.
  • The opening tutorial was completely re-written. It’s an all new example to provide, I hope, a more gentle introduction to testing in Rails.
  • The code samples in general are better. In the first book, a lot of the samples after the tutorial were not part of distributed code. Most of the samples in this book will tie back to the tutorial, and are runnable.
  • The JavaScript chapter will be nearly completely new.
  • A new chapter on testing external services
  • A new chapter on testing for security (at least one of these three won’t be in the initial beta)
  • A new chapter on debugging and troubleshooting. (Not in the initial beta)
  • A new chapter on running tests more efficiently, looking at both the Spring/Zeus preloader option and the don’t load Rails, plain old Ruby object option. (These last two might get combined) (Not in the initial beta)
  • Somewhat more emphasis, I hope, on using testing in practice, somewhat less on duplicating reference information.
  • Some thing that were full chapters in the first book are de-emphasized, and covered sparingly if at all: Shoulda (since it’s not really used anymore), Rails core integration tests (in lieu of spending more time on Capybara), Rcov (may get mentioned, won’t get emphasis), Rails core performance testing (again, may get mentioned in one of the other chapters)

I’m really happy with how the book is coming along, and I hope you all like it in just one short month.

Monday Morning Me: October 7

Rails Test Prescriptions, trddNoel Rappin1 Comment

Monday Morning Me

I’ve skipped a few Monday Morning Me’s due to Ruby DCamp and a couple of other things. DCamp was awesome, and maybe beyond my humble ability to do a trip report. In the meantime..

Rails Test Prescriptions

Ground has been broken and progress is being made. Not a lot of ground, and not a lot of progress, but ground and progress nevertheless. So, yay, that.

When last I wrote about this, I was debating whether to use MiniTest or RSpec as the main test framework for the book. After a couple of impassioned pro-MiniTest pleas at Ruby DCamp last week, I’ve come around to the idea that MiniTest’s availability and simplicity trump RSpec’s mindshare and ecosystem, at lest for teaching purposes.

However…

The first real code section of Rails Test Prescriptions is a TDD walkthrough of adding a first feature to a new project.

One of the guiding principles of the book is that I want the advice and techniques to reflect effective practice, or at least effective practice as I understand it.

My normal practice for adding a new feature would be an outside-in approach: write an end-to-end test describing the new behavior, then fill in logic with focused unit tests. Normally, I would use Cucumber and RSpec for this. But, as mentioned, the book is using MiniTest instead of RSpec. And I don’t want to bring Cucumber in right at the beginning for similar reasons — too much to explain.

Which leaves me writing end-to-end tests using Rails integration tests (ugh) or Capybara, which, of course, also involves bringing in a new gem. Which I’m doing, but the Capybara MiniTest gem wants to use the MiniSpec syntax, which I don’t want to use because more explaining of details early on and all. (Update Mike Moore points out that I’m overstating the extent to which Capybara MiniTest wants to use MiniSpec as opposed to allows MiniSpec. I still am not sure that a lot of people are actually using MiniTest/no spec syntax/capybara.)

So it occurs to me that in the guise of coming up with a testing stack that will make sense to testing novices I have stumbled with the best of intentions into a set of libraries that as far as I can tell is in active use by effectively nobody in the entire world.

This is either insane, or so sane that it’s amazing. Statistically, the odds are on insane, but I’d love a second opinion.

It seems like my viable options are:

  • Do what I’m doing and assume that I can explain it well enough to make sense.
  • Back out and use Rails integration tests instead of Capybara
  • Back out and use RSpec instead of MiniTest
  • Back out and write the Angular book instead. (This is not really an option)

I’m open to comments if you have a suggestion.

Other than that, it’s just been a matter of getting used to changes in the build tools, and finding an editor setup that plays nicely with the formats that Prag uses. Nothing too bad, though I’m seriously considering that Editorial on the iPad has a real shot of becoming my primary editor for this book (writing it on the iPad next to coding on my laptop). Which is also clearly so insane that it may lap all the way around and become sane again.

Trust-Driven Development

Obviously, I’ve missed my plan to get something out in September. I have about 30 some odd pages of text, and I’d release it except that some of the sections kind of trail off in mid paragraph. I may just release it anyway, I have a beta reader or two looking at the manuscript to answer that very question.

If you want slightly earlier access, let me know via email (noel at noelrappin dot com). And, of course, you can by what exists of the book at /trdd.

Mastering Space and Time

So sales have started to pick up at the new price level. Not setting the world on fire or anything, but a more steady rate. Let me know if you are interested in writing about Master Space and time in JavaScript on your blog or something. And, the book is still available at /mstwjs.

Rails Test Prescriptions 2 Is Coming

Rails Test Prescriptions, mstjs, trddNoel Rappin2 Comments

I’m pleased and more than a little surprised to be announcing the existence of Rails Test Prescriptions 2, (which may not be the final title).

You have questions. Even if you don’t, I have answers.

Can you give the news in the style of a movie poster tag line?

Sure.

Coming in 2014. It’s time to get your prescription… refilled.

Rails Test Prescriptions 2: The re-prescriptioning.

When did this happen?

Really, just last week. I got an email asking if I was interested (Spoiler Alert: I was.), and we went very quickly through to contract.

What will it cover?

It’s a little up in the air still, but broadly, we’ve got this:

  • Updates to the big tools. Rails 4, RSpec 3, minitest replacing TestUnit.
  • Changes to the ecosystem, so updates to a bunch of other tools, including FactoryGirl, Cucumber, Capybara
  • Some deprecations — there are some tools discussed that are basically not anymore.
  • New tools. I think the biggest class of tool not discussed in the original RTP is quick startup tools like Spork and Zeus. I’d like to cover continuous integration options, too, we’ll see if I can make that fit.

Over and above all of that, of course, is the fact that the discussion over good testing practice has changed. There’s a lot more talk about maintaining large test suites, writing faster tests, and using tests to drive better Rails application design. I’m planning to talk about that aspect of testing as well.

I am really open to feedback and ideas about what to include and what can be safely removed (any Rails performance testing fans in the audience?)

Timeframe?

Good question. I’d bet at least spring for the first beta. Ask me again in a few weeks.

Are you insane?

I assume you are referring to the fact that I have other writing projects in process.

Yeah, that. Well?

I’ve got it under control.

Yeah, I’m gonna need more than that, writer guy

Okay, let’s take them one at a time.

Okay. Master Space and Time with JavaScript: Ember

Well, the nice folk at Ember central were nice enough to release Ember 1.0, making my plan considerably more concrete than it might otherwise be.

I’m currently working on the draft-complete release of the Ember book, which I expect to release this week. Code up to date with Ember 1.0 and Ember Data 1.0 beta. Info on the Ember inspector, and more stuff on components and promises in Ember routing. Maybe another goodie or two if I have time. That should take me roughly to 115 - 120 pages, a complete draft, and it will trigger a price increase. If I release the book this week, the price increase will come about 9/16. You can still buy Master Space and Time With JavaScript with the handy-dandy purchase link.

The Ember team has announced plans to do new point releases every six weeks. My expectation is that through the end of 2013, I’ll fix errors, and come back toward the end of the year to see if there is anything that needs updating or adding. Probably the same through at least the beginning of 2014.

Okay. What about Trust-Driven Development?

That’s obviously a little more problematic. But I’m really happy with the book, it’s fun to write, and I’m going to keep up with it.

The initial release will still come in September, hoping for this week, but that one looks optimistic. Next week is a better bet. That release also triggers a price increase. And of course, you can still buy Trust-Driven Development at the fabulous purchase link.

After that, I’m not sure. One thing about this book, though, is that it is kind of a nice palette cleaner to break up writing just about code all the time, so I’m actually looking forward to having that as a project during breaks in the Rails Test Prescription 2 process, such as technical reviews and so on.

So maybe I am insane after all.

Anyway, I’m very much looking forward to revisiting Rails Test Prescriptions, fixing all the things I got wrong last time, and making all new mistakes. Hope you like it.