Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6850381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:07:03+00:00 2026-05-27T01:07:03+00:00

Is is posable to disable selected automated tests at runtime? I’m using VSTS and

  • 0

Is is posable to disable selected automated tests at runtime?

I’m using VSTS and rhino mocks and have some intergation tests that require an external dependancy to be installed (MQ). Not all the developers on my team have this installed.

Currently all the tests that require MQ inherit from a base class that checks if MQ is installed and if is not sets the test result to inconclusive. This works as it stops the tests from running, but marks the test run as unsuccseessful and can hide other failures.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:07:04+00:00Added an answer on May 27, 2026 at 1:07 am

    Finaly got aroung to figuring this out, here is what I did.

    In each of my test classes (or methods if only a small number of tests in the class require MQ) that had MQ dependancies I added the following to the class (or method) decleration

    #if !RunMQTests
        [Ignore]
    #endif
    

    This disables the tests unless you have the conditional compalation symbol RunMQTests decleared, this symbol is not defined in the project files so the tests are disabled by default.

    To enable these tests with out developers having to remember if they have MQ installed and adding or removing the conditional compalation symbol, I created a custom build task that will tell us if MQ is installed.

    /// <summary>
    /// An MSBuild task that checks to see if MQ is installed on the current machine.
    /// </summary>
    public class IsMQInstalled : Task
    {
        /* Constructors removed for brevity */
    
        /// <summary>Is MQ installed?</summary>
        [Output]
        public bool Installed { get; set; }
    
        /// <summary>The method called by MSBuild to run this task.</summary>
        /// <returns>true, task will never report failure</returns>
        public override bool Execute()
        {
            try
            {
                // this will fail with an exception if MQ isn't installed
                new MQQueueManager();
                Installed = true;
            }
            catch { /* MQ is not installed */ }
    
            return true;
        }
    }
    

    Then we just need to hook this up into the build process by adding the task to the top of the test project file.

    <UsingTask TaskName="IsMQInstalled" AssemblyFile="..\..\References\CustomBuildTasks.dll" />
    

    And call the new custom task in the BeforeBuild target and set the conditional compalation symbol if this machine has MQ installed.

    <Target Name="BeforeBuild">
      <IsMQInstalled>
        <Output TaskParameter="Installed" PropertyName="MQInstalled" />
      </IsMQInstalled>
      <Message Text="Is MQ installed: $(MQInstalled)" Importance="High" />
      <PropertyGroup Condition="$(MQInstalled)">
        <DefineConstants>$(DefineConstants);RunMQTests</DefineConstants>
      </PropertyGroup>
    </Target>
    

    This lets users that have MQ installed to run our MQ intergration tests, while not failing test runs for users that don’t.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an application using Symfony 1.4. Is it posible to disable a
Is is possable to create and delete queues using the amqdnet wrapper, or some
Is it posable to make an app that can connect to a Windows Active
I have two applications. I want to disable one according a field stored in
I have some issues resolving an algorithm used to find all posible combinations taking
I like to know if it is posible disable the error messages that appear
Can anyone recommend a JavaScript+HTML5 library that supports posable figures? Think about those wooden
Is this posible? The reason for this is that I'm using a table like
Is it posible to notify user that session has expired? Can browser act as
Is it posible to control what objects get generated when using the SchemaExport tool.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.