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?