| Author |
Is this a stub, mock, or fake?
|
Greg Charles
Bartender
Joined: Oct 01, 2001
Posts: 2542
|
|
I'm working on a client/server application that uses a class DbAccess to manage a database connection. The basic interface:
That's not exactly how I would design it, but for now I need to live with it.
The openConnection() method gets a connection from a DataSource configured and maintained by the app server. I've made a subclass that overrides openConnection() to make a one-off connection to the database via the DriverManager instead, and I'm using this for various outside-of-the-container testing. Would I call this subclass a fake, stub, or mock? I think fake is the right term, but I'd like an expert opinion.
Let's say now that I also have a subclass of DbAccess that returns a fake (or mock or stub) ResultSet, which reads data out of text files and bypasses the database altogether. I'm struggling coming up with good names for these classes. How about DbAccessConnectionFake and DbAccessDataFake / ResultSetDataFake? I'm not liking that a lot.
|
 |
 |
|
|
subject: Is this a stub, mock, or fake?
|
|
|