what is the relation of smooth compact supported funtions and real analytic function?
Assume $f$ is a real-analytic test function which is not identically zero; this will lead to a contradiction. Let $K$ denote the support of $f$. The idea (also present in OP's attempt) is to expand $f$ into a power series centered at some boundary point $x_0$ of the support; find that the coefficients are all zero, obtain a contradiction. Key steps:
- A nonempty bounded set must have nonempty boundary (because the only sets with empty boundary are $\varnothing$ and $\mathbb R^n$).
- Let $x_0$ be a boundary point of $K$. Note that $x_0\in K$ and $x_0$ is also a limit point of the complement of $K$.
- All derivatives of $f$ are identically zero on the complement of $K$
- They are also continuous on all of $\mathbb R^n$. By continuity they are equal to zero at $x_0$.
- The power series of $f$ centered at $x_0$ is $0+0(x-x_0)+\dots$
- Therefore, $f$ is equal to zero in some neighborhood of $x_0$. But this contradicts the definition of support of $K$.
If by "test function" you mean a smooth function with compact support (as opposed to a Schwarz function), then the answer is no. Consider an analytic function $f \in C_c^\infty(\mathbb R^n)$ and a point $x$ outside of its support. Because $f$ is analytic, it must equal its own Taylor series developed at $x$, i.e. $0$, and since the radius of convergence is infinite, $f$ must be the zero function.
The upshot of this is that analytic functions are very rigid objects. Loosely speaking, perturbing an analytic function in a single point causes global changes to "ripple" out from the perturbation in order to preserve analyticity.
A test function is a smooth and compactly supported function, while a real analytic function is smooth and given by a power series uniformly converging at every point.
Perhaps I will only give a hint as an answer to your second question: A test function must be equal to zero everywhere outside some compact set. If it were also analytic, then what would the coefficients of its power series have to be?