Tests: implement common function for generation a data source