I have a question on how to put a PDE into weak form, and more importantly, how to properly choose the space of test functions. I know that for an elliptic problem, we want to start with a problem like $Lu = f$, multiply by a smooth test function $v$, integrate by parts typically and we end up with a bilinear form $a(u,v) = l(v)$, where $a$ is coercive and bounded and $l$ is a bounded functional on some Hilbert space $H$. Then, Lax Milgram will tell us there exists a unique solution $u \in H$ of the above problem for all $v \in H$. My question is: how do we properly choose the Hilbert space $H$?
An example from a book of mine: if we have $-\Delta u = f$ on $\Omega$ with the condition that $u = 0$ on $\partial \Omega$, then we multiply by a smooth function $v$, and integrate by parts to arrive at
$$\int_{\Omega} \nabla u \nabla v dx = \int_{\Omega} fv dx \text{ for all } v \in H^1_0(\Omega).$$ I certainly see that choosing $H^1_0(\Omega)$ sounds reasonable, as that condition ensures that $v$ satisfies the boundary condition and also that the bilinear form $a(u,v)$ makes sense (i.e., the integral of $\nabla u \nabla v$ makes sense). Is this the only possibility for a Hilbert space we could choose of test functions? What if we know ahead of time that our solution $u$ is extremely smooth (let's say our data $f$ is $C^{\infty}$ for example). Would it be permissible, albeit un-necessary to choose our test function space to be $H^2_0(\Omega)$? What are the criteria for choosing this space of test functions? Do we choose the test function space to A: make sure the bilinear form $a(u,v)$ makes sense (i.e., we can differentiate the test functions enough times and they're still in $L^2$) and B: they satisfy the boundary conditions?
I apologize if this question is unclear, and thanks for any help!