Judge platform for desired caps

In test case always write the desired caps for different devices, so duplicated code is constructed, so how to avoid it and then make it better

put caps for each device somewhere e.g. json file. by device name get them and apply.

@Aleksei Yeah it makes sense, but do you have example for this, I know use yaml file to manage it and then it works well. But the documents never mention it .