Statistical test to determine if a relationship is linear? What is the best statistical test to use if I measure the value of $Y$ (e.g. pH) for specific values of $X$ e.g. $X=0,10,20,30,...,100$ (e.g. temperature) and I want to test weather the relationship between $X$ and $Y$ is linear? (i.e. $H_0$: The relationship between $X$ and $Y$ is linear, $H_1$: The relationship between $X$ and $Y$ is not linear).
My thoughts
I was thinking of  either a Pearson's rank test, however on further reading it appears this cannot in fact be used to test linearity or a model misspecification test but I think the data set would be to small for any reasonable progress to be made with such a test.
 A: Any rank test will only test for monotonicity, and a highly nonlinear relationship can certainly be monotone. So any rank-based test won't be helpful.
I would recommend that you fit a linear and a nonlinear model and assess whether the nonlinear model explains a significantly larger amount of variance via ANOVA. Here is a little example in R:
set.seed(1)
xx <- runif(100)
yy <- xx^2+rnorm(100,0,0.1)
plot(xx,yy)


model.linear <- lm(yy~xx)
model.squared <- lm(yy~poly(xx,2))
anova(model.linear,model.squared)

Analysis of Variance Table

Model 1: yy ~ xx
Model 2: yy ~ poly(xx, 2)
  Res.Df     RSS Df Sum of Sq      F    Pr(>F)    
1     98 1.27901                                  
2     97 0.86772  1   0.41129 45.977 9.396e-10 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

In this particular case, the ANOVA correctly identifies nonlinearity.
Of course, you can also look at higher orders than squares. Or use splines instead of unrestricted polynomials. Or harmonics. It really depends on what specific alternatives you have in mind, which will in turn depend on your specific use case.
A: Along the lines of what @Kolassa said, I would suggest fitting a non-parametric model (something like a cubic spline smoother) to your data, and see if the improvement in the fit is significant. 
If I remember well, the book "Generalized Additive Models", by Hastie and Tibshirani, contains a description of test that can be used for that.
