Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Running UI Tests from Bamboo

Troels Larsen March 19, 2012

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

0 votes
Answer accepted
Scott Goodwin May 8, 2012

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

0 votes
Ashwani July 28, 2015

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,

 

0 votes
Troels Larsen May 23, 2012

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

0 votes
ReneR
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2012

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.

Troels Larsen March 20, 2012

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.

0 votes
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 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?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events