Test ErrorProvider errors

Help
Phil T.
2007-11-01
2013-04-24
  • Phil T.

    Phil T. - 2007-11-01

    Hi,

    I would like to know if it's possible to test that on a user action the errorProvider pops an error icon beside a control?

    I tried to just add a ControlTester on my errorProvider but it throws an NoSuchControlException error...

    Am I doing something wrong, or it's juste impossible?

    Thank you!

     
    • Phil T.

      Phil T. - 2007-11-01

      oups wrong place, sorry!

       
    • Phil T.

      Phil T. - 2007-11-01

      Sorry again! :s it was the good place!!

       
    • Luke Maxon

      Luke Maxon - 2007-11-01

      I had someone ask this before.. I think the problem is that ErrorProviders are not Controls; instead they are Components. It should not be impossible to get them, but I don't think the code supports it.

      Luke

       
    • eherdt

      eherdt - 2008-01-22

      Hi Phil,

      in order to check if an error provider pops an icon you have to check if error message is empty. I use a little helper method for this:

      private static string DXErrorMessage(Control control)
      {
          return new DXErrorProvider().GetError(control);
      }

      test code:

      ControlTester memoText = new ControlTester("mEModifyText", formName);
      Assert.IsEmpty(DXErrorMessage(memoText.Properties));

      I use DevExpress ErrorProvider, but this should works with plain .net ErrorProvider too.

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks