Z-tests are statistical calculations that can be used to compare the population mean to a sample mean The z-score is used to tellsbhow far in standard deviations a data point is from the mean of the data set. z-test compares a sample to a defined population and is typically used for dealing with problems relating to large samples (n > 30). Z-tests can also be used to test a hypothesis. Z-test is most useful when the standard deviation is known.
Like z-tests, t-tests are used to test a hypothesis, but a t-test asks whether a difference between the means of two groups is not likely to have occurred because of random chance. Usually, t-tests are used when dealing with problems with a small sample size (n < 30).
Both tests (z-tests and t-tests) are used in data with normal distribution (a sample data or population data that is evenly distributed around the mean).