New homogeneity tests for general case and spatial markov as a special case