You have to proactively manage your own career. You are assigned to a task outside your technical specialty and which is not one you want to do. This is not abnormal, I have never worked anywhere that didn't give me "other duties as assigned." And the more senior I have gotten, them more of these I have because someone who can understand the business as well as development can be very valuable in a senior context. However, what you are describing goes well beyond the norm.
If you want to be assigned other work, you have to do a couple of things:
First, make sure you are person someone would want on their technical team. In part that means doing a decent job (note I did not say "do a super excellent, nobody can possibly replace me at this" job) at what you are assigned whether it is boring or not. There is no reason to give you more technical responsibilities if you haven't done reasonably well at the responsibilities you were given. This is particularly true when you have no track record at the company in your real technical field. (There is a lot to learn from getting in the nitty gritty detail of testing. It may make you a better programmer when you get back to it. But still - not full time for months.)
Next talk to your boss about assigning programming tasks to you and about how long this particular task can be expected to last. You have done him a favor by doing this work that no one else wanted to do (the junior people are often given the least wanted work), now ask for your reward.
In the future when being given tasks outside your expertise, talk specifically about how long you will be expected to do them and when you can return to your normal work at the time the other work is assigned. You have to hit a balance here between being a team player and being a doormat that every cruddy job can be thrown to. If you don't ask for what you want, you will not likely get it. Your boss should be aware that you expect to be rewarded for doing a task he needs done that is outside the normal scope of your duties.
Be aware that you might be doing this particular task because there is currently no work for you or because a new project is coming up they want you for but can't put you on just yet and they are keeping you busy in the meantime. Knowing the reasons behind the assignment could make it more palatable. This is why it is important to have upfront discussions of the tasks outside your normal job description and the impact it might have on you.
In any event, this is not the long-term work you want to do. You need to make sure your boss is aware of that and if you do not get a good response to your request to be moved back to the work you were hired for, then it may be time to look for another job. You say you are in a large organization, you may be able to find a group that needs devs and ask for a lateral transfer. Or you might have to look outside the company. It is a fine thing to be a team player and help out where it is need without regard to your job description, but this has gone way beyond helping out and is actively affecting your own future career path. It is time to ask to be reassigned or move on.
Pay attention to the grapevine at your company, find out about upcoming work and put in your request to be assigned to something particular that is coming up. Politic for the assignments you want. If you don't, well you can see the result of that right now, can't you? This is too short a space to get into how to play the political game, but I would suggest you read a few books on the subject. They will help you manage your own career.