Can anyone explain this test failure (only when run via the Teamcity build agent)

I posted my question here first:

Issue: I've an acceptance test (written in NUnit) which spawns an executable, which it then drives via the White 0.2 library. The executable creates a log file in the LocalAppData folder of the currently logged in user. The acceptance verifies if the log file contains the expected text. However when run via TeamCity, I get a FileNotFoundException with the path to the LocalSystem account's app data folder.

The tests all pass when run via NUnit in my local user's account (or when run via Resharper through the IDE)


I would try the following things:
- run agent service under regular user account instead of local system account or
- start agent via agent.bat


Thanks for the suggestions.

Option1 is not feasible - since my acceptance tests written in NUnit go through the GUI and need the "Interacts with desktop" permission for the agent service, which AFAIK is only available with the System account.

I'm looking at invoking the agent via the batch file - can I attach directly to the batch file or is there a test runner exe that I need to attach to ? Basically I'd like to step through the code to know why the log file is not being created (and there are no exceptions) when the test is run in the LocalSystem account.


Not sure what you mean by attach to bat file. agent.bat will start agent JVM, which in turn will start build in the separate process. So you will be able to attach debugger or any other tool to this process.


Please sign in to leave a comment.