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

  • SEARCH
  • Home
  • 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 3876546
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:23:39+00:00 2026-05-19T22:23:39+00:00

My question is focused on if my setup is currently following a best practice

  • 0

My question is focused on if my setup is currently following a best practice approach regarding BDD with UI acceptance testing. I’m using WatiN with SpecFlow to build my UI acceptance tests and I’m deploying my application to AppHarbor (a cloud platform as a service for .Net applications). AppHarbor runs your unit/integration tests upon deployment and only pushes your site live if your tests pass. So I started by first writing a basic failing test as follows:

Scenario: Navigation to homepage
          When I navigate to /
          Then I should be on the application homepage

The steps associated with this test open up a browser using WatiN and verify the title attribute of the view is set to “Welcome”. I am doing a check on the environment to decide what URL to test against with the WatiN browser. For example, if in development navigate to “http://localhost:49641/” for home. Otherwise, navigate to “http://myappharborapp.com/”.

My problem is that if you are deploying this application for the first time, the page or view actually does not exist and so the test fails (because the site is not live yet). This would also fail if for instance I would later add an “About” page view and wrote a failing test first. When I push the updates the test will fail because the “About” page does not yet exist.

My question then is: Am I not following best practices with regards to how you should be setting up your UI tests? How should these tests be setup so that they pass in any environment?

Any insight is greatly appreciated!

  • 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-19T22:23:40+00:00Added an answer on May 19, 2026 at 10:23 pm

    In “traditional” watin tests I use custom attributes to specify what version of an application and what environment it is running in, and then the test is skipped if the critiera is missed.

    (The code is open source in at http://testingstax.codeplex.com in the parkcalc sample > observer > environment monitor)

        internal static void CheckSetEnvironment()
        {
            Object[] attributes = Utility.GetCallerAttributes(typeof(ExecutionEnvironment), 3);
    
            CheckEnvironment(attributes);
        }
    
        private static void CheckEnvironment(Object[] attributes)
        {
            TestEnvironment = GetCurrentEnvironment();
    
            if (attributes.Length > 0 && !attributes.Contains(new ExecutionEnvironment(TestEnvironment)))
            {
                Assert.Inconclusive("This test is not designed to be executed in the '" + TestEnvironment.ToString() + "' environment.");   
            }
        }
    
        private static EnvironmentType GetCurrentEnvironment()
        {
            string currentEnvironment = ConfigurationManager.AppSettings["Environment"].ToLower(CultureInfo.CurrentCulture);
            EnvironmentType Environment = new EnvironmentType();
    
            try
            {
                Environment = (EnvironmentType)Enum.Parse(typeof(EnvironmentType), currentEnvironment, true);
            }
            catch (System.ArgumentException)
            {
                Assert.Fail(" The current environment setting in 'Environment' in the app.config is invalid.");
            }
            return Environment;
        }
    

    The trick would then be to map a specflow action to ignore the test

    “Given the test is not running in production” or something similar

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

Sidebar

Related Questions

This is more of a general best practice question rather than a very focused
Question: I'm interested to know the best practice for killing a long standing operation
I have a question using these same examples - this question is focused on
Question: How can I document Ruby code using Doxygen? Disclaimer: I know ruby already
I just started using java so sorry if this question's answer is obvious. I
I am currently using an older version of Umbraco (4.03) and I have several
Question How do you save view widget instance state when, by using XML-defined widget
This may be a more math focused question, but wanted to ask here because
** This question has been edited to make it simpler and more focused **
The question is: How to make default button be focused on form focus and

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.