Configuration file in automation framework | JSON file | Selenium C#

Опубликовано: 25 Октябрь 2024
на канале: Maximum Automation
12,284
99

In this video we are going to see that how to add configuration file in the framework.

We can create our configuration file in any format, it might be a text file, properties file or can be a json file.

In this video I am gonna use json file for our configuration settings.

To use json configuration we have to install the package Microsoft.Extension.configuration.json.

Once the package will get installed then add below code to build json file.
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.AddJsonFile(configsettingpath);

After that add an object of IConfigurationRoot to build the configuration.
IConfigurationRoot configuration = builder.Build();

and at last we will bind the configsetting class with the configuration.... configuration.Bind(config);

Install the package Microsoft.extension.configuration.binder to bind the json file with class object.

Now we can use these settings in our framework to make things configurable.

**********Please comment in case of any query.**************

Also, please see other videos as well.

Selenium with C# - Klov Report :    • Selenium with C# | Klov Report Server  

Selenium with C# - Extent Report :    • Selenium with C# | Extent Report  

Selenium with C# - Create Project to automate test (Selenium + Specflow ) :    • Video  

Selenium with C# - Parallel Execution and Screenshot :    • Video  

Selenium with C# - All about feature files :    • Video  

Serilog - Logging in Automation Framework :    • Serilog | Logging in Automation Frame...  

Selenium with C# - Specflow - External Bindings :    • Selenium C# | Specflow | External Bin...  

Selenium - Working with Excel - Part 1 :    • Video  

Selenium with Java - Cucumber Html Report :    • Selenium with Java | Cucumber Html Re...