Imagine you're going up to the 8th floor when the lift shudders, then stops. You wait but nothing happens. It looks like you're going to be there for some time. You turn to the sole other occupant of the lift and - well, who would you like to be stuck with? Do you want to be stuck with the person who drones on about how hopeless the situation is, or the one who thinks of an escape plan? Would you prefer the person who tells you at length about their very dull, static life, or the one who has plenty of interesting stories? And at a more basic level, would you like the one who is distinctly lacking in attractive qualities, compared to the one who is full of life and energy?
Reading a novel is a bit like being stuck in a lift with a set of characters, if you think about the length of time it takes to read one. It usually takes me about eight hours to read a novel, and that may be spread out over several days or even weeks. So I need the characters to be engaging or I'll put the book down.
When I'm writing, at the back of my mind I'm imagining what it would be like to be stuck in the lift for eight hours with my main character. Life may not be going well for them, but they don't, won't, can't whine about it. Instead, they're busy trying to work out an escape plan. Perhaps because we worry whether readers will like our main character there's a tendency to make them bland, and I suppose it's better to be bland than out and out offensive. But only just better. Instead, apply the lift test. The characters to write about - good, bad or plain ugly - are always going to be the ones who make those eight hours seem like eight minutes.