AspNetDevelopmentServer40 local web server and BaseUrl not working as expected

4 posts, 1 answers
  1. seanwic
    seanwic avatar
    4 posts
    Member since:
    Sep 2012

    Posted 07 Jul 2011 Link to this post

    Hi,

    I have recently come across the WebAii Testing Framework and as a proof of concept wanted to implement some tests using NUnit against one of our projects (ASP.NET MVC 2).

    The following config is set:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <configSections>
        <section name="WebAii.Settings" type="ArtOfTest.WebAii.Core.SettingsConfigSectionHandler, ArtOfTest.WebAii" />
        <section name="WebAii.Settings.Web" type="ArtOfTest.WebAii.Core.WebSettingsConfigSectionHandler, ArtOfTest.WebAii" />
      </configSections>
      
      <WebAii.Settings.Web
        aspNetDevServerPort="1234"
        localWebServer="AspNetDevelopmentServer40"
        defaultBrowser="InternetExplorer"
        enableScriptLogging="true"
        enableSilverlight="false"
        enableUILessRequestViewing="false"
        killBrowserProcessOnClose="false"
        recycleBrowser="false"
        silverlightApplicationPath=""
        silverlightConnectTimeout="30000"
        useHttpProxy="false"
        verboseHttpProxy="false"
        webAppPhysicalPath="C:\mysite\mysite.Web"
        />
      
      <WebAii.Settings
        annotateExecution="false"
        annotationMode="All"
        clientReadyTimeout="30000"
        createLogFile="true"
        enableUILessRequestViewing="false"
        executionDelay="200"
        executionTimeout="20000"
        logAnnotations="false"
        logLocation="C:\WebAiiLog\"
        queryEventLogErrorsOnExit="false"
        simulatedMouseMoveSpeed="0.3"
        unexpectedDialogAction="HandleAndFailTest"
        waitCheckInterval="500"
        xMultiMgr="false"
      />
      
    </configuration>

    And the code in my unit test looks is:
    // Launch a browser instance
    Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
    // The active browser
    ActiveBrowser.NavigateTo(@"~/Home");

    I am expecting to navigate to: http://localdev.mydomain:1234/mysite/Home
    But get: http://localhost:1234/Home instead

    I have the following mapping in my hosts file:
    127.0.0.1       localdev.mydomain

    I'm not sure if I have my settings wrong? I would appreciate any help with this issue.

    Thanks

  2. Answer
    Cody
    Admin
    Cody avatar
    3354 posts

    Posted 07 Jul 2011 Link to this post

    Hi Seanwic,

    This setting:

    localWebServer="AspNetDevelopmentServer40"

    tells the framework you want to launch the ASP.NET development server on your local machine and run tests against the web application located at the path specified by webAppPhysicalPath running on that development server. This means we're always going to use "localhost" and the port number specified in aspNetDevServerPort instead of the baseUrl value i.e. baseUrl is ignored in this configuration for NavigateTo steps.

    If you want to use the baseUrl instead of the ASP.NET development server (or manually launch your application via the development server before running your test) then leave localWebServer set to "None" or remove the setting all together (it will default to None then).

    All the best,
    Cody
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  3. seanwic
    seanwic avatar
    4 posts
    Member since:
    Sep 2012

    Posted 07 Jul 2011 Link to this post

    Hi Cody,

    Thanks for the reply. I thought that this might be the case. 

    I have resolved this by kicking off WebDev.WebServer40 via a batch file and specifying the relevant virtual path using the /vpath: parameter in the command line. 

    Having the ability to specify the vpath when using AspNetDevelopmentServer40 as a local webserver would be of great benefit as this should allow me to use the dev webserver in my scenario without having to call a batch file.

    Thanks
  4. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 08 Jul 2011 Link to this post

    Hi Seanwic,

    We very much appreciate the feedback! I have entered a feature request for this.

    Greetings,
    Cody
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
Back to Top