Question: How does one manage to stay relevant as a programmer while bouncing between different engineering areas (Testing, Integration, etc) and remaining motivated in the profession?
Don't think of them as discreet tasks so much. If you're doing testing right (automated testing, tests first, tests as specifications of behavior) then testing is an inextricably linked component of just about every piece of the engineering process. I've personally found that my motivation and happiness level are directly correlated to the freedom I have to do the job right. Don't let managers tell you how to do your job; if they do, politely tell them that you feel like you're being micromanaged, and that you would like to be entrusted with the full responsibility of the engineering process ? surely they wouldn't have hired you in the first place if they didn't think you knew what you were doing. Be sure to pitch it positively; i.e. this will help them to be more successful because it frees up more of their time to concentrate on the "what" and the "why" rather than the "how". Always be diplomatic, believe in what you're selling, and be prepared for either responsibilities or consequences ? you're going to get one or the other. If the manager doesn't like that, start looking for another job. I recognize that people have families to support, which is why I didn't say "Quit right then and there," but programmers need to recognize that bad managers are the #1 source of unhappiness on the job. If you're unhappy, it affects not only you, but also your family, and you owe it to them as well as yourself to find a job you enjoy and a group of people you can work with successfully. (Google is hiring by the way.)
Learn strategically useful skills, like say, evented I/O. If, for example, you can do evented I/O well, you'll never be out of work. Node.js is a great place to start there because it makes it easy to do small experimental projects in. The ability to use multiple processors effectively has eluded the grasp of many, but a well-designed event-based system really helps. Know your stuff in realms like this and the demand for your skills will be exceedingly high. Remember, the job market is just that: a market. It follows the laws of supply and demand. You always want to position yourself in the low-supply, high-demand corner. This is the corner of the graph where all of the "strategically useful skills" are.
Write open source. I know this is a community that's very friendly to closed-source and proprietary code, but I can't emphasize this enough. Open source is a community, and in a community, you get to know people. Networking has always been the best source of good jobs around. Open source makes it easy for you as a person to be hired into a job that you will love: If you've written open source, there's a good chance that you wrote code you care about. Companies that happen to use your code are subsequently much, much more likely to seek you out and try to hire you, and more importantly, that means they're hiring you to do something you already know you enjoy. I don't have enough fingers to count how many times it's happened to me, though a lot of that was while I was freelancing ? YMMV. And even if that doesn't happen, open source projects give potential employers a chance to see real code that you've written; if nothing else, assuming it's good code, that dramatically ups your chances for an interview.
Always scratch your own itches. "Itches" tend to become passions.