0

I am working in automated UI test suite and we want to separate our test data and store it in JSON files. Ideally, we want to have our tests (Nunit + Teststack.White) in a compiled dll, and then anyone should be able to edit those JSON files without touching and recompiling the tests dll. And the tests should pick up those changes in data.

For example, there is a json file with order details, and a user should be able to change some order details, and then run that dll again.

Is it possible to achieve that by embedding resources in the project? Or do we have to come up with a different solution? Thanks

  • 2
    When you embed the resources, you need at leas a kind of "build", which isn't really different to just compile. You probably just have to write tests which load files in a specific folder and use it one after the other. – Stefan Steinegger Apr 06 '16 at 11:26
  • Okay, so just load them from a specific folder. Thanks! Are there any disadvantages to this approach from embedding files as resources? – Vladyslav Babych Apr 06 '16 at 13:36
  • 1
    You have to make sure that the files are available. E.g. loading from C:\Temp is not a great idea. It would not allow to have different branches with different data running on the same machine. You might have a machine without C drive at all. So use relative paths. You probably need something to automatically and safely deploy the files. – Stefan Steinegger Apr 06 '16 at 13:51
  • Thanks! It was very helpful! – Vladyslav Babych Apr 08 '16 at 08:49
  • I make it an answer because you didn't get any until now, so there is at least this. – Stefan Steinegger Apr 08 '16 at 10:52

1 Answers1

1

(From my comments)

When you embed the resources, you need at leas a kind of "build", which isn't really different to just compile. You probably just have to write tests which load files in a specific folder and use it one after the other.

You have to make sure that the files are available. E.g. loading from C:\Temp is not a great idea. It would not allow to have different branches with different data running on the same machine. You might have a machine without C drive at all. So use relative paths. You probably need something to automatically and safely deploy the files.

Stefan Steinegger
  • 63,782
  • 15
  • 129
  • 193