Which is the best/efficient way for a QAE to test the field validations for a sign up form:

1: Do I need to create a util class to randomly generate the data? or

2: Do I need to take hard-coded test data in an excel sheet?

I am in dilemma, in which concept to choose between these, please help.


For the field validation I would recommend to use predefined set of test data. Since form validation mechanisms usually validate for certain rules it will be easy to prepare data that would fail validation on one hand and it will be hard to implement the algorithm that would produce "random" data that would obligatory fail the check.


Don't just randomize test data for all input validations instead design data based on boundary value analysis & equivalence class partitioning principals and make data driven tests.

And randomize test data for positive values only within acceptable value range.


I would use an pre-existing library like Faker to create random data if possible. Most programming languages already have libraries like this already created. You should try to use those before creating your own. Also, they allow you to specific the length of the randomly generated string so you can test different boundaries like: 8 char, 16 char, 32 char, etc.

You can write a utility class or extend a library for any methods which the library doesn't have which are specific to your application.

Hardcoding the values in an excel sheet is okay because you can access and reuse it I guess. But one of the reasons for random testing is to find unexpected bugs. The hardcoded values are values that you thought might break a certain feature. But what happens if the feature broke in an unexpected way? Random testing is designed to increase the range of your tests by increasing the number of different input variants with minimal effort. Really good video explaining random testing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.