There are really three Sobolev spaces, which in many situations are provably the same, but the details concerning boundary values are (unsurprisingly) a large technical issue.
The a-priori smallest space is the closure of _test_functions_ (compactly supported smooth, with support in the interior of the domain) with respect to the Sobolev norm. The a-priori middle-sized Sobolev space is the closure of _smooth_functions_ with respect to the Sobolev norm. The a-priori largest Sobolev space is the collection of distributions with the corresponding distributional derivatives in $L^p$. (A relatively recent book by Gerd Grubb, "Distributions and Operators", discusses the impact of boundary conditions.)
In nice situations, such as "free space" problems, all these spaces are readily proven to be the same.
With boundary issues, some not-necessarily intuitive things can happen, since Sobolev norms (while arguably more appropriate than $C^k$ norms for discussion of PDEs) are not instantly comparable to classical pointwise ($C^k$) norms. That is, there is the "loss" of $n/2+\epsilon$ arising in Sobolev's inequality.
Nevertheless, there are "trace theorems", which with smooth boundaries predict accurately what loss of Sobolev index occurs upon restriction to the boundary: it is half the codimension, so, typically, $1/2$.
For example, an $L^2$ limit of test functions (supported in the interior) certainly can have non-zero boundary values. Raising the Sobolev-norm's index implies vanishing on the boundary in a (typically less-by-$1/2$) Sobolev space on the boundary. Comparison to $C^k$ norms is via Sobolev's inequality.