You are viewing a read-only archive of the Blogs.Harvard network. Learn more.

Integrating Jasmine with Travis CI

One of the things I’ve been wanting to automate with our Harmony Lab project is the javascript test suite so that it runs via Travis CI. I tried once before, but hit a wall and abandoned the effort. I recently had the opportunity to work on this as part of a professional development day in ATG, which is an excellent practice that I think all departments should embrace, but that’s a topic for another day. If you’re not familiar with Travis, it’s a free continuous integration service that provides hooks for github so that whenever you push to a branch, it can run some tests and return pass/fail (among other things). Getting this to work with a suite of python unit tests is easy enough according to the docs, but incorporating javascript tests is less straightforward.

Harmony Lab JS tests use the Jasmine testing framework and all of the unit tests are created as RequireJS modules. This is nice because each unit test, which I’ll call a spec file, independently defines the dependencies it needs and then loads them asynchronously (if you’re not using RequireJS, I highly recommend it!). Running the Harmony Lab tests locally is a simple matter of pointing your browser to http://localhost:8000/jasmine. This makes a request to Django which traverses the spec directory on the file system and finds all spec files, and then returns a response that executes all of the specs and reports the results via jasmine’s HTMl reporter. But for headless testing, we don’t want to be running a django server unless it’s absolutely necessary. It would be nice if we could just execute some javascript in a static html page.

It turns out, we can! The result of integrating jasmine with phantomjs and travis CI is Harmony Lab Pull Request #39. You can check out the PR for all the nitty-gritty details. The main stumbling block was getting requirejs to play nicely with phantomjs and getting the specs to load properly. The phantomjs javascript code, that is, the javascript that controls the browser, was the simplest part since it only needed to listen for the final pass/fail message from jasmine via console.log and then propagate that to travis.

Posted in Continuous Integration, Harmony Lab, Javascript. Comments Off on Integrating Jasmine with Travis CI »

Agile Context Switching

I had the pleasure of trying to work on 3 separate agile projects last sprint. I typically get 40-50 story points done in a sprint. I like to take on more than I think I can do to keep myself from letting work expand to fill time. I also had the issue of having to take on another developer’s work. Total, we promised ~80 story points.

Now, when my kid was new and I wasn’t allowed to sleep nights, I was able to cram 70-80 sps into a sprint. But sleep has made that level of productivity very hard.

I was also tasked with working offsite, organizing a community of practice, and trying to learn a very large project through “osmosis”. Which is to say, learn as much as you can without reporting time spent on it.

I have to admit, all of the work is interesting and the clients are all people I personally don’t want to let down. So it’s hard to say “forget project X”. (Which is hard to say generally when there actually is a project X.)

So with many things pulling me in many directions, my completed story points for the sprint was 33. A significant decrease in general productivity.

Context switching needs to be allocated for in sprint planning. Duh?

The trick is how much? Some people say it takes 15-30 min to effectively context switch. That’s part of it. I think the larger part is when you’re focused on one-two items, you can finish things effectively. The more items, the more you end up with partial work. Partial work is the worst time killer. You get 50% into a feature and if you have to stop and start again it magically turns into 30-40% done.

Solution? Don’t switch contexts.

Har har. Work on something to completion before switching contexts. Be strict about it.

Posted in Agile, ATG, Development, Flashcards, Harmony Lab, Quizmo. Tags: , . Comments Off on Agile Context Switching »

Harmony Lab

One of the nice things about my job is being able to take credit for interesting student projects. We’ve got an awesome pool of kids that are always doing stuff. They have cool ideas, write up a sloppy implementation and don’t want to maintain it. So it comes to us and we have the opportunity to polish it and expand it for use to a broader audience.

The most recent of these projects to come along is the newly named “Harmony Lab”. (Formerly GoFigure / Piano Lab) This is a nice application that allows you to hook up a midi keyboard to your computer and get information about music theory stuffs (and by “music theory stuffs” I mean I haven’t yet wrapped my head around everything the application does).

Currently it is an application that uses an applet to get the midi data from the keyboard and a ton of javascript for visualizing the key/chord. And a ton of javascript is never a pretty thing.

We are giving it a backend for some authentication, cleaning up the javascript where we can, and adding some extra functionality — hopefully not too much extra. This is a cool project, but it’s usefulness is limited to one or two classes.

What’s cool about this is it’s a (potentially) simple application so it lets us play with (learn) something new (to us). So we went for python Django.

It’s available on github from the start.

Posted in ATG, Harmony Lab. Tags: , , , . Comments Off on Harmony Lab »