When to Use Z-test:
The sample size should be greater than 30. Otherwise, we should use the t-test. Samples should be drawn at random from the population. The standard deviation of the population should be known. Samples that are drawn from the population should be independent of each other. The data should be normally distributed, however for large sample size, it is assumed to have a normal distribution.