For testing a simple null hypothesis $\theta=\theta_0$ vs alternative $\theta\ne\theta_0$, the definition of p-value given a UMP (usually) test $\mathbb{1}(T>k)$ (reject when $T>k$ where $k$ be chosen such that $E(\mathbb{1}(T>k))=\alpha$ for some statistics $T$ and realized value $t_0$ is $$P_{\theta_0}(T>t_0)$$
My question is is there a definition of p-value for testing hypothesis such as $H_0:\theta\in(\theta_1,\theta_2)$ vs $H_1:\theta\notin(\theta_1,\theta_2)$. Furthermore, if the test is not in the form $\mathbb{1}(T>k)$, what shall we do?