Testosterone can help for depression. I would be seeking to find potentially what is causing the depression first. For people who take testosterone by prescription, their testosterone levels are below healthy levels, sometimes really low. This is what causes their depression and therefore increasing insufficient levels of testosterone has beneficial effects. That being said, steroids like all other substances are often abused. Testosterone like speed makes you feel good which can help take the edge off your problems but the actual dependency on steroids creates more problems on top of the already existing problems that got you taking steroids in the first place. Speed for example can be therapeutic if and when it's used in the context of therapy but unfortunately many people take speed to run away from their problems and so their problems get worse and now are amplified by the abuse of speed.
I have taken steroids for the best part of 7 years and I have done a lot of research on them. I have tried quite a few compounds both oral and injectable; deca, npp, tren, all test base esters, dianabol, equipose, anavar, anadrol. All at optimal levels and then, well, potentially detrimental levels too. I've found that the allure with steroids is far darker and the motives behind taking them far more concerning than what most people perceive at the surface level. You try being around people who cannot function without being on inhumane dosages of steroids. They are a nightmare, particularly if they are using steroids as a crutch. I say that having found out myself what it's like having trained in underground bodybuilder gyms and absorbing the culture and getting to know people. Many are addicted to steroids and they cannot function without them. Many start taking them because they want to rid themselves a particular flaw, insecurity, perceived weakness etc and then steroids help to superficially find a solution ie by getting bigger, stronger etc. The flaws themselves still exist but now they are hidden away, these might be mental and emotional difficulties, and they often are. Many people who abuse steroids have experienced trauma and/or sustained periods of difficulties and so they use steroids as escapism, just like any other drug. Links to domestic violence and incarceration are hugely increased when a person is abusing steroids as are traits for personality disorders and severe symptoms of mental disorders that contribute to social and personal harms.
What I'm trying to get at, as someone with 'insider' knowledge of the world of steroids is, it's not rainbows and pettycoats. Understand WHY you want to take them and then when, and if, you start taking them, understand WHY you want to continue taking them. If you find that you feel better, great, but make sure that better is not simply an altered state of consciousness that maintains distance from what reality is like when you're not taking them. When you come down, when you don't feel invincible and you're now human again, it can be quite an adjustment to return to normal life when you're used to being so high on potentially way higher levels of testosterone than the average healthy male. It can easily become about maintaining the high as apposed to using them for the original intended benefit. This is why personally I come off steroids every now and then in order to get slapped by reality so that I come down from the pedastal you'll find many steroid users find themselves on due to changes physically, mentally and emotionally. I do it so I understand that taking steroids isn't a form of escapism and all that needs to happen for me to see the reality of my life is to stop injecting steroids and the raw truth presents itself. I'll come off solid for anywhere from a few months to a year, maybe two.
Did they work for my depression? Yeah. But I also have low T levels anyway. I was a skinny kid at school, massively underdeveloped, didn't start puberty properly until I started taking gear and that's when I was around 22-23 by the way. All the other kids at school were showing off their pubic hair and facial hair and I struggled to grow one hair on my chin up until I took gear. So for me the need to actually get on gear was real and it genuinely changed my life. That being said, have I abused steroids since then? You bet. And the thing is, you can easily go from just doing it therapeutically to all-out abuse. The dosage will go from a reasonable amount, say 300-500mg, to 700, 800, 1000mg. I sometimes want to pretend there isn't an issue and that I'm not addicted and I don't need them etc but I also know that when I'm doing all that I'm actually in addiction. The challenge then is lowering the dose to a therapeutic one (around 150mg every week) and it doesn't become an addiction anymore because I'm simply replacing the low levels of T I always have had. I also come off and simply deal with the low T levels in order to prove to myself there is life beyond steroid use. My low T levels are not so low I'm not producing it but they are concerning. Low T is low T, if you have it it's generally not a good thing. I can manage it pretty well and had done all my life prior to discovering steroids.
The abuse potential for steroids is REAL. And because they don't often show the same signs as other drugs where it seems obvious they are addicted, the consequences are real and they exist. Steroids change you, for better or for worse. I've been on the end of both sides. I once almost started a fight with a guy waiting for a bus because he pushed in. It was completely unnecessary and it was simply a benign isolated event but I was so angry and so amped up you'd have thought he had murdered my dog. That one moment in my life, that came completely out of the blue, made me realize that there is a fine line with steroids and it's very easy to cross. All you have to do is not be conscious of these changes and detour from potentially therapeutic goals to now abusing them and the results of this will speak for themselves. They can make you more detached from certain things and can make you worse, depending on how deal with your shit.
Steroids are not a magic bullet. Their abuse/harm potential is very real and needs to be taken very seriously. You don't want to be prescribing yourself, or be prescribed, a drug that will grow to enable dysfunctional coping mechanisms, habits and lifestyle choices. For that you need something else completely because the issue is far deeper than a needle will go.
Hope this helps

P.S also research, research, research, research