Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Tools
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Monthly Archives: October 2012

David Varvel

10/19/12: Super Happy Blogging Friday

David Varvel
Friday, October 19, 2012

Interestings

  • accepts_nested_attributes and validates_presense_of on association id fails without inverse_of

Having a validation that the association id is present when trying to use nested attributes fails because the child object is validated before the parent object in memory has an id.

However, if you decorate the association with :inverse_of, it tells Rails to look in memory first which both saves memory and allows Rails to build the graph of objects correctly with validation!

Yay inverse_of!

Events

  • Super Happy Dev House in SF tomorrow

Mother of all hack days. They’re usually down in the valley! http://shdh52.eventbrite.com/

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Max Brunsfeld

what, CI Reporter?

Max Brunsfeld
Thursday, October 18, 2012

Helps

  • iPad/iOS – full page redraws

iOS devices do a full-page redraw when we introduce new height at the bottom of the page or when backgrounding/foregrounding the browser. How to avoid that?

  • Jasmine not working when run through jenkins

Jasmine:ci on firefox fails on CI only with the error:

/home/ci/.rvm/gems/ruby-1.9.3-p194@gemini/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok’: ReferenceError: jsApiReporter is not defined (Selenium::WebDriver::Error::JavascriptError)

Anyone seen this? It runs great on the command line when we ssh into the ci box, but fails when run through Jenkins.

Interestings

  • JS – objects on prototypes

In javascript, if you give a prototype an object property, then mutating that object will do so for all instances of the class.

So if you do this:

MyClass.prototype.things = {
  "foo": "cool"
};

var instance1 = new MyClass(),
instance2 = new MyClass();

instance1.things["bar"] = 5;

then

instance2.things["bar"] === 5
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Brian Lesperance

[Standup][NY] 10/17/12: FireSASS

Brian Lesperance
Wednesday, October 17, 2012

Interestings

Chrome Canary builds ape Firebug’s FireSASS

A bestiary of SASSy fun! I’ve heard (but not confirmed) that Chrome’s new canary build offers SASS support, a la FireSASS, i.e., it points to the SASS line number (rather than the CSS line number). Huzzah!

https://twitter.com/anthonyshort/status/236256012259180545

Events

Wednesday: WEDS: Database Event

Explore techniques for merging traditional database concepts (including immediate consistency and reliability) with the flexibility and high performance seen in NoSQL database systems.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Max Brunsfeld

No go on #nogo

Max Brunsfeld
Wednesday, October 17, 2012

Helps

  • #nogo links triggered on Firefox 15.0.1

We are using jqeury-ui-selectmenu and on some menus, selecting from the menu routes to the embedded href in the link (#nogo) instead of triggering the handlers. This is only a problem on firefox 15.0.1+.

Interestings

  • UTF-8 encoded emails in ActionMailer

We ran into a problem with incorrectly encoded UTF-8 characters in emails generated by our rails app.

We spent a few hours investigating this. It turns out the premailer-rails3 gem we were using for CSS inlining was at fault. We switched to the actionmailer_inline_css gem, which handles UTF-8 properly.

This is likely to be an issue for any Rails 3 site that puts user generated content in email templates (names, etc).

-Maksim

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Max Brunsfeld

Super secret special standup

Max Brunsfeld
Monday, October 15, 2012

Interestings

  • Interested in speaking at the East Bay Ruby Meetup?
    Ruby-81 meets near on campus at Cal and is looking for speakers. It’s a great place to get started with professional public speaking.

  • iOS6′s super aggressive caching
    IOS6 apps will now much more aggressively cache http requests, even POST requests! This can trip you up when upgrading, so be prepared to add cache settings to your AJAX requests.

http://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Robbie Clutton

Testing Strategies

Robbie Clutton
Monday, October 15, 2012

In order to improve the build time of a recent project, we took steps to identify and split out our build based on an emergent testing strategy. I will try to outline that strategy based on things we tried and thoughts we had. In an attempt not to descend into a discussion over tools and library preferences, I will only mention our intentions and not tools. Where I supply code examples, these will be in pseudo code in the Given/When/Then style.

We commonly use the ‘outside-in’ testing pattern, and that is how I will describe the steps we have taken when thinking about this strategy.

End to end testing

I believe there are two broad types of end to end testing which fit nicely into white box and black box testing methods. In both cases we drive the application from the outside interfaces, often a web UI.

On this recent project we had an overwhelming number of tests that drove a web UI. Anyone who has done web UI testing will know the time if often takes to run these tests. We frequently repeated a series of steps to get the application into a known state before getting to the actual test. This led to an ever increasing build time. In order to get the build time under control, we started to programmatically get the application in the right state before visiting the part of the application under inspection. This was not to replace the previous tests, but complement them.

These thoughts were recently solidified by Badri Janakiraman in his talk on Creating maintainable automated acceptance tests. When talking about curation of tests, Badri mentions identifying the core user journeys in an application. He goes onto encourage extracting those journeys from the acceptance test suite. The remaining tests are of a more functional feature, as in they are testing functions of a system, rather than the system holistically.

For example, a journey test may look like the following


Given an anonymous user

When I select items for my shopping cart and checkout

Then I receive an email with confirmation of my purchase

A functional test may look more like the following


Given a user at the checkout

When that user applies a discount code

Then a discount is applied to the final cost

These may not look all that different, but the journey is testing an end to end core path of the system. The code underneath should only drive the web UI in trying to accomplish this task. However the functional test gets the system into the state required and then drives the web UI to complete the test and run assertions.

Integration Testing

With end to end testing, we inspected our application from it’s very edges. We controlled a web browser so that the tests behaved as if it were a user of the application. With integration testing, we want to inspect a slice of our application but we will do so by calling application code directly rather than drive a UI.

Our tests will look very similar to our functional end to end test.


Given a shopping cart

When a discount code is added

Then that code cannot be redeemed in another shopping cart

We are testing functions of the application and we want to ensure all parts of the application are integrated correctly. We will test at certain layers but the execution paths will visit many areas of the code base, dependent libraries and persistent mechanisms.

Testing can occur at various layers and it really depends on where you want the test coverage. Testing database integration is a good example of this sort of test. The application has started, perhaps there are classes which talk to a database directly through a driver using a query language or maybe the code goes through a library that abstracts the intricacies of the underlying persistence system. It can sometimes seem as if the library is being tested rather than the logic of the application but by focusing on complex queries, validations and scopes can reduce the likelihood of that happening.

What to do with third party services?

These examples may include interacting with a third party service, perhaps some payment service. For this, the test may choose to stub out the interaction with the external service, or run a fully integrated test. Integration with the service should absolutely be tested, but I leave it to the reader to decide where that test runs.

I like to have the possibility of running offline so I would consider integration with 3rd party services as being a separate part of any testing strategy. As with testing 3rd party libraries, you don’t want or probably need to test these as much, especially if there are limits or costs involved. However with the prevalence of software as a service offerings out there it is wise to have tests that run something in the order of once a day to make sure no breaking changes have occurred in the service and that the application continues to integrate as expected. These tests may not be part of the main build pipeline but you’d also want these to run if your application went into maintenance mode to ensure the service remains compatible.

Dealing with non-deterministic tests

Non-deterministic tests are the bane of any project. When the build time increases a flakey test can really suck the reliability out of any build. One way to deal with these tests is to ‘quarantine’ them. This typically means having a new build in your CI server which is triggered by the core build. This means if it fails you only have to run this one build instead of all of the rest of the tests you know are ok. In many CI servers, triggers can be configured to fire on many things, including a failed build. If the flakey build keeps retrying when it fails then it will pass soon enough. If this build is included in any pipeline to staging and production you can make sure all the tests are good, even if it just once.

This is a way of dealing with flakey tests, but I’m not endorsing keeping them there. Efforts should be made to fix those and get them back into the core build.

Unit Testing

One of the anti-patterns that comes up is hitting the database in unit tests. I’ve heard arguments in favour of this, but what you’re really trying to test is the business logic of your application, not the persistence library you’re using. I’m not saying don’t have tests that hit the database at all, but they should be reserved for elsewhere in your testing strategy, notably in the integration and end to end stages.

If you really must have a database in your unit tests, consider using an in-memory database so you avoid all the disk reading and writing. I know some will say you should be using the same setup as much as possible as your production environment, but those environments will be tested in a later phase of the strategy.

Another possibility is wrapping your tests in a transaction that can be rolled back. Many tests I’ve seen rebuild datasets for each test or group of tests and this can mean a lot of time spent doing setup rather than test execution. If you rollback on each test, nothing will be committed to the database, ensuring the data is consistent without rebuilding each time.

Summary

Tests are a way to increase confidence in an application but that confidence can be shattered if you do not trust your tests, or they take so long to run that you bypass them in various ways. Fundamentally, tests and build scripts should be considered in the same way that production code is. This small change of thought process can lead to better, more reliable and quicker tests.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Robbie Clutton

Standup NY: 10/12/12: All the events

Robbie Clutton
Friday, October 12, 2012

Interestings

Android: View.onTouchEvent()

If you get an ACTION_DOWN event in View.onTouchEvent() and you return false, then you will not get the corresponding ACTION_UP event.

If you follow some of the easy to find and clear online examples for GestureDetector you might not return true when handling the onTouchEvent. Without ACTION_UP events some gestures will never register.

This is wrong:
@Override
public boolean onTouchEvent(MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}

Do this instead:
@Override
public boolean onTouchEvent(MotionEvent event){
gestureDetector.onTouchEvent(event);
return true;
}

Events

Monday: MON: PyLadies Meetup in Grand Central

A group for Python ladies of all levels of programming experience, in the NYC metro area.

Monday: MON: Database Event in Main Event Space

Explore techniques for merging traditional database concepts (including immediate consistency and reliability) with the flexibility and high performance seen in NoSQL database systems.

Tuesday: TUES: Agile Experience Meetup in Main Event Space

A key trend among UX designers on Agile teams is a shift away from using software to create design docs like wireframes and personas, and instead creating specs by hand.

Tuesday: TUES: NYC Machine- Probabalistic Graphic Models in Grand Central

In this class, you will learn the basics of the PGM representation and how to construct them, using both human knowledge and machine learning techniques.

Wednesday: WEDS: Database Event

Explore techniques for merging traditional database concepts (including immediate consistency and reliability) with the flexibility and high performance seen in NoSQL database systems.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Vinson Chuong

Server Side Events?

Vinson Chuong
Thursday, October 11, 2012

Helps

  • Any experience with HTML5 SSE?

I want to try out HTML5′s Server-Side-Events (http://www.igvita.com/2011/08/26/server-sent-event-notifications-with-html5/) in my Rails 3.2 application. Any experience or thoughts on how to integrate?

The basic flow will be:

  1. User does some action
  2. Browser sends RESTful POST to server
  3. Server then re-broadcast’s event to all other clients using SSE
  4. Clients consume and refresh their views

lather-rinse-repeat

  • Is it worth the pain to deploy jruby /warbler /tomcat?

A current client is designing their production deploy architecture and there is a lot of resistance to a nginx/unicorn/rails stack.

Is it worth exploring jRuby inside Tomcat?

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
John Barker

Cleaning old branches

John Barker
Thursday, October 11, 2012

We’re using Github pull requests on our project. Which means whenever a pull request is accepted, a branch is left lying around.

So I wrote a quick script to remove all remote branches that have been merged into develop (our working branch, you’ll have to alter the first instance of ‘develop’ to master if you use a more typical git branching model).

Here goes:

git branch -r --merged develop | sed 's/ *origin///' | grep -v 'master$' | grep -v HEAD | xargs -n 1 printf "echo git push origin :%sn" | bash
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Ronan Dunlop

Tracker Ecosystem: Wazoku – Transmuting ideas into stories

Ronan Dunlop
Thursday, October 11, 2012

Wazoku’s Idea Spotlight is a fabulous new tool for Product Managers to manage and filter product development ideas. Now that they’ve integrated Tracker (We’re flattered to be their first third party integration), it’s borderline alchemical, transmuting raw ideas into stories is simple and seamless.

What Wazoku provides is a structure to the process of collecting and capturing ideas and a place where these can then be evaluated and analysed. The benefit to you and me is that it can help manage your Icebox and increase collaboration on development ideas.

Above and beyond great functionality, the team at Wazoku are offering an exclusive 25% off for life, just for Pivotal Tracker users. Maybe it’s their Robot icon… but the “I’d buy that for a dollar” line from Robocop comes to mind.

Try it out, tell us what you think and be sure to enter this promo code on the sign up form: PTPC25F

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Topics

  • agile (783)
  • rails (117)
  • testing (90)
  • ruby (85)
  • ruby on rails (71)
  • jobs (62)
  • javascript (59)
  • techtalk (44)
  • ironblogger (42)
  • rspec (39)
  • bloggerdome (34)
  • productivity (34)
  • activerecord (30)
  • rubymine (30)
  • git (29)
  • gogaruco (29)
  • nyc (27)
  • design (24)
  • mobile (23)
  • pivotal tracker (22)
  • process (21)
  • cucumber (21)
  • jasmine (19)
  • ios (18)
  • tracker ecosystem (17)
  • webos (17)
  • objective-c (17)
  • fun (16)
  • android (16)
  • palm (16)
  • ci (16)
  • "soft" ware (16)
  • bdd (15)
  • tdd (15)
  • cedar (15)
  • rails3 (14)
  • performance (14)
  • css (14)
  • gem (13)
  • mouse-free development (12)
  • selenium (12)
  • goruco (12)
  • bundler (12)
  • api (12)
  • keyboard (11)
  • meetup (11)
  • railsconf (11)
  • nyc-standup (11)
  • capybara (10)
  • mac (10)
Subscribe to Community Feed
  1. ←
  2. 1
  3. 2
  4. 3
  5. →
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Tools
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >