A random variable used in hypothesis testing to determine whether to support or reject the null hypothesis.
A hypothesis test will use a distribution (normal distribution, t-distribution, etc) with a known area to calculate a p-value that your results are due to chance. The p-value is the used in combination with the test statistic to draw your conclusions, if there is a large enough test statistic and small enough p-value you may be able to reject the null hypothesis.
Test statistic for sign tests
If the hypothesis was testing as assumed median we could use a sign test and calculate how many observations are above and below that assumed median. The test statistic is the smaller of the number of values lying below or the number lying above the assumed median.
Test statistic for one-sample z-tests
Where ‘A’ is the hypothesised mean, this is the formula for the test statistic for a one-sample z-test: