Caves Travel Diving Graphics Mizar Texts Cuisine Lemkov Contact Map RSS Polski
Trybiks' Dive Texts Testing YAC Software
  Back

List

Charsets

Charts

DBExpress

Delphi

HTML

Intraweb

MSTest

PHP

Programming

R

Rhino Mocks

Software

Testing

UI Testing

VB.NET

VCL

WPF

Testing
  • AssertWasCalled and Methods Called Multiple Times
    AssertWasCalled allows you to check if the object's method was called during the test. Until now, in our tests, we were testing single calls to such methods; such checks will fail, however, if the method is called multiple times during the test (with the same parameter values). You can define additional parameters in AssertWasCalled calls that handle this situation.

  • AssertWas[Not]Called and Object Properties
    AssertWasCalled and AssertWasNotCalled allow you to check if the object's method was called during the test (or not). Checking access to object properties depends on their declaration: whether they're ReadOnly, WriteOnly, or read/write.

  • Rhino Mocks's AssertWasNotCalled
    AssertWasCalled allows you to check if the given method was called during the test. AssertWasNotCalled, on the other hand, allows you to check that a method was not called during the test.

  • Visual Studio - moving coded UI tests to a new / different project results in null reference exceptions
    You've just moved a coded UI test, with all the necessary assembly references and source files, to a new or a different project (a project with no UI tests yet), and now you're getting null reference errors?
    Well, here's some Visual Studio programming trivia that might help you.

  • PrivateObject and Out/ByRef parameters
    I got an interesting question to the previous article on PrivateObject: What about testing private/protected methods with Out/ByRef parameters?

  • PrivateObject, WithEvents, and generics
    In the previous texts on PrivateObject (here, here, and here) all examples dealt with simple fields and non-generic types. Moreover, the examples in the last text were a bit contrived - at least I have never found the need to access private members of base classes... I think. However, the solution discussed there will help in one particular example - accessing protected fields marked with WithEvents in base generic classes.

  • Accessing private members of base classes
    In the previous text on PrivateObject and PrivateType we saw how PrivateObject can be used to access private and protected members of an object under test. However, sometimes, you may also need to access some of the members of the object's ancestor. PrivateObject can still be used in that scenario - you just need to construct it using a PrivateType.

  • PrivateObject and WithEvents
    In the previous text on PrivateObject I described how private and protected members can be accessed in automated tests. There's one caveat to this - accessing fields declared WithEvents.

  • Accessing private and protected members - PrivateObject and PrivateType
    Need access to private / protected members of an object when doing unit tests? Use PrivateObject and PrivateType.

  • VS - Test Run Error - "COM object that has been separated from its underlying RCW cannot be used"
    Getting a "COM object that has been separated from its underlying RCW cannot be used" error when running tests in Visual Studio? If it's because you're opening WPF windows, then the solution could be quite simple...

  • Get the TreeViewItem for an Item in a WPF TreeView
    When unit testing a user control with a tree view, I wanted to simulate mouse clicks on tree view items. But then it turned out that it's not that straightforward to get the control that displays the item (and that I needed to raise the mouse event for)...

  • Output in MSTest Tests (VS 2010)
    Can't find output from Console / Debug / Trace .WriteLine statements when running unit tests in VS 2010? Here's a short text showing where everything goes.

  • Automated WPF tests and "Invalid URI: Invalid port specified."
    If, when running tests, you reference a resource using the pack://application: URI syntax (regardless whether this reference is in the test code or in the actual application code) you'll probably get this exception: "System.UriFormatException: Invalid URI: Invalid port specified." There is information about this on the web, but the two easiest solutions aren't that easy to find (they're there, just buried in longer discussions). Here, I give a short description of the problem, description of solutions that won't help you (well, at least didn't help me), and the two quick solutions. If you want to see those - just skip to the end.

  • Checking Property Change Notifications
    Worried about type safety of property change notifications (INotifyPropertyChanged) in your VB.NET apps? Six lines of code will help in making sure that those are, actually, defined correctly.

  • Checking "Dangling" Event Handlers in Delphi Forms
    I like Visual Form Inheritance (VFI) in Delphi, but the tool support could be much better. One things that like to get out of sync. when working on form hierarchies is event handler mappings between events and the respective procedures. Here's a small procedure that will check any discrepancies in that area.

  • Rhino Mocks's AssertWasCalled in VB.NET
    Using a big new library in any project can be quite daunting. But, IMO, the best way to learn one is to just start using it. And then, after a while, the more advanced functions will become apparent. But where to start?

    In this text you'll find a gentle introduction to Rhino Mocks that shows the simplest scenario where the library can be used - creating object stubs to facilitate testing.

  • First steps with Rhino Mocks (in VB.NET)
    Using a big new library in any project can be quite daunting. But, IMO, the best way to learn one is to just start using it. And then, after a while, the more advanced functions will become apparent. But where to start?

    In this text you'll find a gentle introduction to Rhino Mocks that shows the simplest scenario where the library can be used - creating object stubs to facilitate testing.

  • VS Pending Tests
    Having problems running unit tests in Visual Studio 2008? Tests remain in "pending" mode forever instead of (finally) succeeding / failing? Well, this hotfix just might help you!

  • Automated GUI Testing
    Ever head problems with testing GUI applications using an external testing program? Or maybe you just want to test a single window/form without the need of running your whole program? Start unit testing you GUIs - it's as simple as standard unit tests.

  • Automated GUI Testing in VMs
    GUI testing, when being run on the development machine, blocks work because you can't use the keyboard or the mouse during the tests. Well, use a virtual machine for your tests while continuing work on the host.

  • Automated Testing of Window Forms
    Tired of continuously verifying tab orders and accelerators in your window forms? How many times have you shipped a program that duplicates shortcuts, doesn't have FocusControl assigned in labels, doesn't have default buttons in dialog windows, etc.? Well, this text describes an approach for automatic testing of window forms (and other controls, for that matter). An approach that, at least for me, saves hours of testing time each week.

  • Detecting Memory Leaks with DUnit
    It's much easier to fix coding faults when these are discovered in the unit testing phase than when they're discovered in further phases of the development cycle. A category of such defects - memory leaks - are usually hard to track down because of their irregular behavior. Then, tracking down the root cause of the problem is often difficult and time consuming.

    When programming in Delphi, DUnit is the obvious choice for unit testing, and thanks to its memory leak detector, helps in the problem mentioned above (and, for other languages, similar unit testing frameworks can be used). However, there are certain caveats to deal with here, and one of these is discussed in the article.
Top