I suppose it depends on your definition of torture. Going to the dentist is painful, or torturous, for us, but it is not torture. The pain is inflicted for a specific, ultimately beneficial reason, and, of course, it's pretty much voluntary.
By the same token, though the animals don't volunteer for it, the ultimate aim of medical research is for the benefit of humanity, ideally. Therefore, scientists can offset the infliction of pain to their test animals because of the potential gains for people. And even then the reputable ones will, if at all possible without screwing up the test results, sedate the animals. And any pain inflicted is not done for sadistic or gratuitous reasons, which is what I would consider torture.
Now, using animals for cosmetic testing, to my mind, is much less justifiable. I couldn't justify in my mind that those animals have to undergo such pain just to make me look better or smell better or feel better about myself. (And believe me, in my case that would require a LOT of pain!)
The other thing you have to remember, though I don't know how much bearing it has, is that the vast majority of these test animals are living only because they are test animals. Is this right? I don't know. Again, I think you have to balance the needs of humanity with the means for meeting those needs.