Is “test statistic” a value or a random variable?

I am a student taking my first Statistics course now. I am confused by the term “test statistic”.

In the following (I saw this in some textbooks), $t$ seems to be a specific value calculated from a specific sample.

However, in the following (I saw this in some other textbooks), $T$ seems to be a random variable.

So, does the term “test statistic” mean a specific value or a random variable, or both?

The tradition in notation is to use an upper case letter (T in the above) to represent a random variable, and a lower case letter (t) to represent a specific value computed or observed of that random variable.

T is a random variable because it represents the results of calculating from a sample chosen randomly. Once you take the sample (and the randomness is over) then you can calculate t, the specific value, and make conclusions based on how t compares to the distribution of T.

So the test statistic is a random variable when we think about all the values it could take on based on all the different samples we could collect. But once we collect a single sample, we calculate a specific value of the test statistic.