jeudi 6 février 2020

Junit Testing with data file

Sorry I the question is duplicated, if its the case, please link the thread.

I want to test Java with Junit. Now I have a data file and read out these datas. How could I validate them? I tried it with class and objects but if I have a lot of test cases, there would be a lot of classes which is uncomfortable to test. My goal is to trigger different actions in java depending on the data's I have read in.

To get my point, here is my example data file:

{
    "fruit": "Apple",
    "size": "Large",
    "color": "Red"
}

We assume that we have read out these key/value pairs.

If I want to continue working with these values, HOW can I validate them? Like how is it possible to check if the key fruit and the value apple is spelled correctly? It could be that I have an alphabet wrench in the inside or something like that.

I hope you can give me other options than making an object an working with them.

Aucun commentaire:

Enregistrer un commentaire