NullReferenceException From TFS Build

7 posts, 0 answers
  1. Thorri
    Thorri avatar
    1 posts
    Member since:
    Sep 2010

    Posted 21 Jun 2011 Link to this post

    Hi All.
    We are trying to run Web tests from our TFS weekly build.

    But all tests fail with the following:

    System.NullReferenceException: Object reference not set to an instance of an object.

    ArtOfTest.WebAii.Core.Manager.SetupDialogMonitoring()
    ArtOfTest.WebAii.Core.Manager.LaunchNewBrowser(BrowserType browserToLaunch, Boolean waitForBrowserToConnect, ProcessWindowStyle windowStyle, String arguments)


    I have registred TFS build interactive port from the following ( http://msdn.microsoft.com/en-us/library/bb399142.aspx ), but that does not seem to have any changes.

    any suggestions on what I have been missing ?

    best regards 
    thorri.


     
  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 27 Jun 2011 Link to this post

    Hi Thorri,

    I am sorry you are running into this problem. Am I correct in assuming the same tests run just fine on your local development machine? What if you manually execute the tests from the command line on the TFS test machine? Here is documentation on how to run tests via MSTest from the command line. Let us know the results of this diagnostic step and we'll go from there.

    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?
  3. Eyjolfur
    Eyjolfur avatar
    6 posts
    Member since:
    May 2011

    Posted 04 Jul 2011 Link to this post

    The tests run fine on local machine and the server when logged in and running the tests with mstest.exe.  Using testlist or testcontainer does not matter, both work fine.
    "Test method MyTest threw exception: System.NullReferenceException: Object reference not set to an instance of an object."

    My fealing is that the problem is server side as the Team Foundation Build service is not "Local System account" and "Allow service to interact with desktop" not checked.

    Is it possible to let the tests run this way?

    cheers,
    Eyjolfur
  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 05 Jul 2011 Link to this post

    Hi Eyjolfur,

    You state "Build service is not "Local System account"... which account is it set to use then?

    Regarding " "Allow service to interact with desktop" not checked" this depends on the test. A pure HTML/DOM test (i.e. one that does not move the mouse or use simulated keystrokes) can run this way. Many HTML tests can work this way. However Silverlight and WPF tests cannot. Most actions in that world must use the mouse and keyboard. The "Allow service to interact with desktop" is what allows (or prevents) a process from using the mouse and/or keyboard.

    Regards,
    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?
  5. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 09 Jul 2011 Link to this post

    Hi Eyjolfur,

     

    Make sure that ALL the following conditions are met for the test server (the machine on which the TFS test agent is running which will also be the machine on which the browser will be opened):

    a) Test agent is running as an interactive process - not as a service (you will need to specify a user and password for the agent to log on)
    b) There is an active login session on the test server for the user mentioned above
    c) The test server is not locked, on standby or hibernated when the test runs
    d) Browser is not minimized when the test runs.

    If all the above are true, log on to the test server yourself (using the user credentials that the test agent is registered under) and see if you can figure out how far it is getting (does the browser come up?  does it connect to the site? etc) and what the problem might be (any exception or other dialogs)?

    Hope that helps,
    Shashi

  6. Mateusz
    Mateusz avatar
    4 posts
    Member since:
    Feb 2012

    Posted 07 Mar 2012 Link to this post

    Hi,

    I have the similar problem problem but we are using Hudson instead of TFS.
    The tests run fine on local machine and the server when logged in and running the tests with mstest.exe.  Using testlist or testcontainer does not matter, both work fine.
    When we run our tests from Hudson as a batch task all of our tests failed with the following:
    System.NullReferenceException: Object reference not set to an instance of an object.

    ArtOfTest.WebAii.Core.Manager.SetupDialogMonitoring()
    ArtOfTest.WebAii.Core.Manager.LaunchNewBrowser(BrowserType browserToLaunch, Boolean waitForBrowserToConnect, ProcessWindowStyle windowStyle, String arguments)

    I also read also http://www.telerik.com/automated-testing-tools/community/forums/test-studio-express/automation-framework/issues-with-telerik-automated-testing-in-hudson-ci.aspx

    Could you sumarize once again how hudson should be configured to run run properly tests?


    Thanks in advance!
    Mateusz
  7. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 07 Mar 2012 Link to this post

    Hi Mateusz,

    You are probably trying to run your tests on a locked machine. This is known to not work for UI automation. Here's an article describing one possible solution to this problem.

    All the best,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!