Blanch the green beans in boiling water for 3 minutes, then plunge into ice water to stop the cooking process. Drain well.
In a skillet, melt butter over medium heat. Add onions and cook until translucent, about 5 minutes.
Add mushrooms and garlic to the skillet, sautéing until mushrooms are browned, about 5 minutes.
Pour in chicken broth and heavy cream, bring to a simmer. Season with salt and pepper. Continue to simmer until the mixture thickens slightly, about 10 minutes.
Stir in the blanched green beans into the mushroom sauce.
Transfer the green bean mixture to a baking dish. Sprinkle with cheddar and Parmesan cheese.
Bake in the preheated oven for 20 minutes, or until the top is golden and bubbly.