Not sure how useful this is for you, but here are two options. Perhaps you can adapt one for your particular case:
1. showexpl Package:
I would recommend you use the showexpl package, which will typeset the content and also list the LaTeX code:

Code:
\documentclass{article}
\usepackage{showexpl}
\usepackage{tikz}
\lstdefinestyle{myLatexStyle}{
language=TeX,
basicstyle=\small\ttfamily,
backgroundcolor=\color{yellow},
numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt,
commentstyle=\color{red},
showstringspaces=false,
keywordstyle=\color{blue}\bfseries,
morekeywords={align,begin},
pos=l
}
\begin{document}
\begin{LTXexample}[style=myLatexStyle, pos=b]
\begin{tikzpicture}
\node [rectangle, draw, fill=blue!20, text width=5em, text centered,
rounded corners, minimum height=4em] {test};
\end{tikzpicture}
\end{LTXexample}
\end{document}
2. Replace \node macro:
The above solution will only show the code that is within the LTXexample environment. So if you still wanted to use a separate drawing macro, the above would only show \theCommand{test}; in the output, which does not provide much information. An alternative is if you replace:
\newcommand\theCommand[1]{%
\node [rectangle, draw, fill=blue!20, text width=5em, text centered,
rounded corners, minimum height=4em] {#1};%
}
to use \ShowAndExecuteNode instead of \node:
\newcommand\theCommand[1]{%
\ShowAndExecuteNode[rectangle, draw, fill=blue!20, text width=5em, text centered,
rounded corners, minimum height=4em]{#1}%
}
then you get the output:

Commenting out the \AtEndDocument{\TikzCodeList} will eliminate this output.
Notes:
Code:
\documentclass{article}
\usepackage{tikz}
\newcommand\TikzCodeList{}%
\newcommand\AddTikzCode[1]{\xdef\TikzCodeList{\TikzCodeList#1\endgraf}}%
\AtEndDocument{\TikzCodeList}%
\newcommand{\ShowAndExecuteNode}[2][]{%
\node [#1] {#2};
\AddTikzCode{node [#1] #2}%
}%
\newcommand\theCommand[1]{%
\ShowAndExecuteNode[rectangle, draw, fill=blue!20, text width=5em, text centered, rounded corners, minimum height=4em]{#1}%
}
\begin{document}
\begin{tikzpicture}
\theCommand{test};
\end{tikzpicture}
\end{document}
tikzpictureenvironment, issuing{\ttfamily\meaning\theCommand}gives the meaning of\theCommand(without passing arguments to it). See, for example, Equivalent of\showto display the LaTeX code in the document and The definitions of LaTeX commands. – Werner Sep 23 '12 at 05:41\tracingall? If so, you are looking at a lot of code for any realistic TikZ picture! – Joseph Wright Sep 23 '12 at 09:15