ESMITHY.NET
Tagged with

Testing

Review of "Python Testing with pytest, Second Edition"

Book Cover

Even though I've been using pytest for years, being a testing enthusiast, I thought I'd read Brian Okken's book to see what I might be able to learn from it. I was pleased to discover not only several tidbits of the workings of pytest I hadn't known about, but also …

Randomness in Tests

Wouldn't it be cool if a few uses of the random module in your unit tests could discover bugs in your code? Meh.

The problem is that random tests are non-deterministic, meaning they lack the highly desirable property that if they pass in my local development environment, they'll also pass …

The First Rule of Test Code

Software is kind of cool in that you can write programs that verify that your other programs work correctly. These testing "meta programs" tend to get short-shrift though, because it's not like the code is actually part of the shipping product. So who cares about cleanliness or good style or …

Unit Testing Silverlight View Models

Being relatively new to Silverlight development, I've not had the good sense to accept conventional wisdom that the Visual Studio unit test framework can't be used to test Silverlight code. For testing view models at least, I've been successfully using Mstest and Rhino Mocks for a few months now.

One …

Mock Object Strategies

How do you get your production code to use real objects and your test code to use mock objects?

Here's the class we want to test (adapted from Object-Oriented Design Heuristics, Arthur J. Riel):

public class HeatFlowRegulator 
{ 
    private Furnace furnace; 
    private Set house;    

    public HeatFlowRegulator(Set house) 
    { 
        this.house = house …

Testing Styles: Favor Unit Testing

Ideally, human efforts in testing should focus on building tests -- figuring out the strategies, test cases, and test data. From there, we'd rather let the computer run the tests and verify the results. If you had to test everything manually every day, you would either not do it, or really …