views:

65

answers:

3

So, you are using a bunch of javascript libraries in a website. Your javascript code calls the several APIs, but every once in a while after an upgrade, one of the API changes, and your code breaks, without you knowing it.

How do you prevent this from happening?

I'm mostly interested in javascript, but any answer regarding dynamically typed languages would be valuable.

+3  A: 

I don't think there's much you can do. You always run a risk when updating any piece of software. The best advice is to:

  • Read and understand documentation about upgrading
  • Upgrade in your test environment
  • TEST
  • Roll out live when you are happy there are no regressions
Andy Hume
+1  A: 

Well there are two options:

  1. Don't upgrade
  2. Retest everything after you upgrade.

There is no way to guarantee that an upgrade won't break something. Even if you have something that could check the underlying API and make sure it still all lines up, you can't be certain that the underlying functionality is the same.

Kevin
+2  A: 

You should consider building unit tests using tools such as JsUnit and Selenium. As long as your code passes the tests, you're good to go. If some tests fail, you would quickly identify what needs to be fixed.

As an example of a suite of Selenium tests, you can check the Google Maps API Tests, which you can download and run locally in your browser.

Daniel Vassallo