简体   繁体   中英

TFS Build Definition Ignore Coded UI Tests

We recently added Coded UI Tests to our solution. The tests complete successfully when ran through Test Explorer but when the code is checked in and a build is triggered, all the CUIT's fail (error message is below).

I have gone to each of the links in the error message. The first one details how to set up a test agent to run the tests. We don't really need tests on all our environments as we are setting up a lab environment to run them and adding the test agent would require me submitting a ticket which would probably take months to get a response back, not to mention walking the person through what needs to be done.

The second link is dead and I'm pretty sure I don't want to change the build to be interactive.

I am hoping there is an easy way to change the build definition (which I have access to) so that it can ignore all Coded UI Tests but still run the Unit Tests. Is this possible? Is there an easier way of going about this? Each set of tests have their own project file, all Coded UI Tests in one project and all Unit Tests in another project.

Thanks in advance.

Here is the error that is on all of the coded UI tests: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" ( http://go.microsoft.com/fwlink/?LinkId=255012 ) If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" ( http://go.microsoft.com/fwlink/?LinkId=254735 ).

One thing you can do is to group all the coded UI tests into a particular test category and exclude running those in the build. We do this with our "integration" tests and only choose to run our true unit tests for speed reasons.

See below link for how to use test categories:

https://msdn.microsoft.com/en-us/library/dd286683.aspx

Also see the below for how to edit your build definition to only run the tests you want:

Excluding tests from tfs build

You can use use some naming patterns and combine that with the Test case Filter option in the execute test step:

Something like:

FullyQualifiedName ~ .Ui.

This would require the Ui tests to have .Ui in the namespace

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM