.net - Resolve Arbitrary Hostname/IP Address in C# -
i'm writing behavior tests in c#, using selenium , chrome web driver. in addition local debugging, want test changes in staging context, forcing c# resolve our site's hostname staging ip address.
is there way set arbitrary ip address given hostname, without editing c:\windows\system32\drivers\etc\hosts, , without setting actual dns records?
for example, when make following call, want selenium go ip address can manually set within context of debugging application:
using(var driver = new chromedriver()) { driver.navigate().gotourl(url); }
your behavior tests should take/read configuration source (custom config file, environment variables, etc) during setup step , takes site address source. instead of changing hosts file or code in tests, change configuration settings.
also, in ideal world, should have different hostnames staging , prod environment... , in case, can use ip address in tests directly, instead of hostname.
Comments
Post a Comment