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 8636135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:09:10+00:00 2026-06-12T10:09:10+00:00

I have written a test with WatiN and when a step through the code

  • 0

I have written a test with WatiN and when a step through the code with F10, the test succeeds, but when I execute the ‘Run Test’ command from the context menu, the test fails.

Here’s my test:

[TestMethod]
[STAThread]
public void Should_show_captcha_after_three_invalid_login_attempts_with_invalid_username()
{
    // Given
    int numberOfLoginAttempts = 3;

    // When
    for (int loginAttempt = 1; loginAttempt <= numberOfLoginAttempts; loginAttempt++)
    {
        EnterUsername(LoginSettings.ValidUserName);
        EnterPassword(loginAttempt.ToString());

        ClickLoginButton();

        // Check we are still on the loginpage
        Assert.IsTrue(_browser.Title.Contains("Inloggen"));
    }

    bool isCaptchaVisible = _browser.Page<LoginPage>().Captcha.Exists;

    // Then
    Assert.IsTrue(isCaptchaVisible);

    // Make sure to clear the login attempts for next test cases
    RemoveLoginAttempts();
}

FYI: In the DB we keep track of the loginAttempts based on the username. When the number of loginattempts is > 2, the captcha is shown. The problem I encounter is that the counter in the DB stays 1. When I manually step through the test, the counter is increased.

How is this possible?

  • 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-06-12T10:09:11+00:00Added an answer on June 12, 2026 at 10:09 am

    Well you are right it’s got to be timing. However part of the problem is this is not a unit test, and the other is there’s a great deal of asynchronous stuff going on that you are assuming will have completed before you execute another line of test code which has been written on the assumption that it has.

    For instance the count in your loop for login attempts is definitely not the one in the db. All things being equal it should match up, but..

    So to me you should have a test of the login function.
    That logins up the colunt in the db if unsucessful, and reset that count if it succeeds.
    Then an other test to see that when login attempts in the db has gone over the limit, login response detects that and shows the the correct response.

    If you want to join all this up for an end to end / whitebox test. Then an automation test of some description should be used.

    I suspect that windows, the browser, your webserver or even your dbms didn’t get time to finish processing the first login attempt, before you’d queued up another two, and then done the test. Whereas in debug mode inbetwen you stepping through, they have plenty of time.

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

Sidebar

Related Questions

I have written this test application: it goes through iterations from 0 to 9999,
This is a simple script I have written to test command line argument handling:
I have written a test where i specify my application context location with annotations.
I have written a large script to run a series of tests. Each test
I have written an Ant target that starts Selenium server, runs my test code,
I have written a test case which shows the error from unittest import *
I have written a test program to take in values from a csv file,
I have written some test code for comparing the performance of using direct property
I have written a ScalaCheck test case within Specs2. The test case gives up
I have written a JUnit test for a private function which is returning String.

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.