Running UI Tests from Bamboo

Hi,

We are having some problems running .Net unit tests from Bamboo. It seems that the results when we run them from bamboo aren't the same as when we run them manually using VS2010 or mstest.

Our theory is that the UI itself isn't being loaded, and we have tested it by adding the following test to our build:

[TestMethod]
        public void TestBamboo()
        {
            var window = new Window();
            window.Loaded += new RoutedEventHandler(window_Loaded);
            window.Show();

            Thread.Sleep(2000);
            window.Close();
        }

        void window_Loaded(object sender, RoutedEventArgs e)
        {
            throw new NotImplementedException();
        }

So the test should fail when the window loads, and it does so from my machine. However, this test succeeds from bamboo.

We have tried running bamboo from the console instead of the service, but to no avail.

How can we run these tests in interactive mode even when we aren't logged into the machine running bamboo?

The build server is a Windows Server 2008 R2, and bamboo is running locally.

5 answers

1 accepted

This widget could not be displayed.

Ran in to this same issue, and it is related to Session 0 Isolation, a security feature of Vista and 7.

I was able to install Bamboo agent as a service, yet kick off GUI tests by using the following advice:

http://www.codeproject.com/Articles/35773/Subverting-Vista-UAC-in-Both-32-and-64-bit-Archite

This widget could not be displayed.
Joe Clark Atlassian Team Mar 20, 2012

I assume your Window is a WinForms app?

You won't be able to run the Bamboo agent as a Windows service - it will need to run as a console app from within a logged-on user session.

How are you running your .NET build tasks? Are you using a shell script to start the test process, or are you using the built-in tasks?

This widget could not be displayed.

Yes. How are you running the Bamboo agent and what credentials is it running with? A system account will NOT have access to the console. Your local tests succeed because you're already logged in to the Desktop with a user (yours) that has access to it.

Setup a local account for the bamboo agent, give it access to the Desktop and run your agent with that or give the system account access to the console.

Hi, thanks for your answers.

To answer your questions:

- This is a WPF app, not WinForms.

- We are using the built-in MSTest Runner task, but have also tried an NAnt script and the MSTest Result Parser.

- We are running the Bamboo console as Administrator, which I would assume would have access to everything.

Maybe we are doing something wrong, but I can't see what that is.

We are logging in to remote desktop, running the console from the shortcut in the start menu (with elevated permissions) and starting the build from the web interface, remote desktop still logged in.

We will try again, but please point out any flaws in our execution if you can find them.

This widget could not be displayed.

Hi Scotty, thanks for the link. For reason beyond my comprehension, we are now able to run these aforementioned tests without changing the session. But I will be sure to keep your link in case it crops up again.

Regards,

Troels

This widget could not be displayed.

Hello Troels,

I am also facing the same issue. GUI is not getting invoked when running test using Mstest through Bamboo build.

Could you please help on this issue.

Many Thanks,

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

76 views 0 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you