mercredi 28 août 2019

How to set up configuration files for a .net core testing project (no ASP.NET)

I'm setting up a testing repository where different developers from different teams will contribute to. Therefore, I need to find a way to store some general configuration and some feature dependent configuration.

The repository I am setting up is using the following technologies / libraries:

  • .NET Core Framework 2.2
  • Specflow to write tests using feature files and step definitions
  • MSTest to run the tests

The basic structure of the repository should be quite simple, there is only one project with two base folders, where one folder is for common code and the other contains a folder for each feature:

  • Project
    • Common
    • Features
      • Feature1
      • Feature2
      • ...

Now I want to have some settings in the common folder (which is maintained by the repository owner) as well as settings for each feature, which are added and maintained by the feature developers:

  • Project
    • Common
      • settings.json
    • Features
      • Feature1
        • settings.json
      • Feature2
        • settings.json
      • ...

The settings should be done in nested json files. Each developer should be able to use access the common settings and his individual feature settings from withiin his code. I'm using a Context Injection from Specflow to inject services into test classes.

My questions are:

How should I set up a proper configuration handling without creating a really configuration mess? There is a lot of documentation online on how to set up a ASP.NET project configuration, but as you see my project setup differs from a common ASP.NET project. There is only ONE environment involved (the testing environment), but a lot of configuration for different features.

Aucun commentaire:

Enregistrer un commentaire