Open hevayo opened 3 years ago
+1 for having test data in a separate module directory. We need to have a means of packing the sample data attached to test cases into the balo file.
Having test data embedded within the test case file directly is one option to consider. For example, we may use special annotation or directly specify sample data as Ballerina records. However, there are multiple practical issues.
Ensuring the quality Irrespective from which source we extract the test data we will have to ensure the quality of the test data provided. For example, we should validate to a major extent the test data we get are the data that we need to run with the test cases. Data with missing attributes, data with different attribute types will be problematic.
It is good to have both valid as well as invalid data to run with test cases (see). But for scenarios like data mapping its always better to have high quality valid data.
Leverage Test Data Generator Tools There is an on going effort to auto generate test data artificially. We could integrate that with this effort so that developer does not need to worry too much about how to specify the sample data, but use the intelligent suggestions and modify them a bit to generate a suitable data set.
In this case the developer will have to be aware of how to generate such test data artificially using the test data generator tools.
Question : What is the best way to define test data?. Test data will be useful for following
Option 1 : Define test data in the source it self
Can we recommend to define test data as ballerina values in source code itself. The test data can reside in the test source or a separate module. Pros:
Cons:
Spec changes required to keep data in ballerina source.