mercredi 1 avril 2020

Test Windows Forms for different app.config files

Our Windows Forms Application is configured by the app.config file, the are 100+ machines running and there are multiple configurations. I would like to test the application with different app.config files, I do this by calling the static main function of the Windows Forms Project, which then calls one form of many depending on the config file.

I would like to start a test with a given config.file:

[TestMethod]
public void ConfigFile1()
{
    string[] args = new string[1];
    args[0] =  "C:\file1.config";
    Program.Main(args);
}

How do I programmatically set the config file? How can I test whether the proper form runs? I cannot change the architecture of the application.

many thanks

Aucun commentaire:

Enregistrer un commentaire