开发者

Test Data: working with external resource files

开发者 https://www.devze.com 2023-03-16 00:24 出处:网络
As part of the program i am working on, i need to accept and process a input configuration fi开发者_如何学运维le from the user. Input file is reasonably complicated and file parser needs to be tested

As part of the program i am working on, i need to accept and process a input configuration fi开发者_如何学运维le from the user. Input file is reasonably complicated and file parser needs to be tested thoroughly.

As part of my testing approach, i created a bunch of resource files:

sample_ActionValueAssignedValid.json
sample_ActionValueMissing.json
sample_ActionValueInvalid.json
sample_ActionValueAssignedWhiteSpace.json

and many many more, each being slightly different, reflecting user's possible input.

At some point, a customer came over and asked for data structure to be modified to include some data and remove something else. Lovely.

Now, I come up with a new perfect sample.json file that has it all. But what to do with all the other resource files, for which tests have already been written? I suppose i can update them one by one ... but i can't but wonder ... there's got to be a better way?

Please let me know, how you would approach a situation like this?


In a similar situation I had to deal with I created a correct and complete input as a base. Then for each test, I programmatically "broke" it to test each scenario. This way you only need to update the main structure once if it changes and update tests only where changes are meaningful.

0

精彩评论

暂无评论...
验证码 换一张
取 消