If you only want to measure the height of foam to evaluate the stability, I recommend that a simple glass tube equipped with a porous slica. To generate the same height of foam, blowing the gas with a constant rate through the silica to the aqueous solution of surfactant. Then collecting the height of foam according to the time.
Specifically for shampoos-foam height & stability are assessed by a standard apparatus known as Ross Miles Column-which more or less uses the principle mentioned above by Hu.
No Ross Miles generates the foam a different way. A defined volume of solution (different dilutions) is poured from a defined height into a graduated cylinder. You measure the height or volume of foam generated and its decay over time.
Foam testing should be close to the desired application.
A simple test could be dropping an Aspirin or similar tablet into a solution in a graduated cylinder.
Based on final application-the test has to be developed. What is the application Abhinav is trying to use? Shampoo, Shaving product or Detergent, Aerosol foam product? Or Is it in some reaction?