|
by: John J. Lee |
last post by:
I had the bright idea a week or two ago to construct mock objects (for
unit testing) "by example" by calling methods on a generic mock
object.
Say we have a class Bar, and we want to check that, when we use
BarUser in a particular way, BarUser first calls method Bar.xyzzy with
args "foo" and bar=2, then method Bar.do_nothing.
# first, construct a mock object by example:
m = Mock()
|
by: John J. Lee |
last post by:
I'm trying define a class to act as a Mock "handler" object for
testing urllib2.OpenerDirector.
OpenerDirector (actually, my copy of it) does dir(handler.__class__)
to find out what methods a handler supports. So, my mock class has to
have appropriate methods defined on it. To avoid the hassle of
manually defining lots of mock classes, I wanted to have a base class
MockHandler so that I could do
class...
|
by: ischenko |
last post by:
There is a (relatively) widely used technique in unit testing, called
mock objects. There is even a pMock library which provides a Mock class
for a Python environment.
Given the "duck typing" nature of the Python itself, it's pretty
trivial to build mocks without using any pre-built libraries. What is
less trivial and potentially more worthwhile is to have a library of
"stock" mock objects.
For instance, I found myself re-implementing...
|
by: David Thielen |
last post by:
Hi;
Are there mock objects anywhere that I can use to write nunit tests for my
code behind methods?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
|
by: Joe Van Dyk |
last post by:
Say I've written a class that wraps around a particular (complex)
communication service library.
I want to unit test objects that use that communication service.
Is the "best practice" to create a Communication_Service abstract base
class that my Concrete_Communication_Service and my
Mock_Communication_Service both inherit from? (and then use the mock
service when unit testing)
|
|
by: Terry |
last post by:
I'm looking at NMock2 as a framework to create mock objects during my unit
testing. One part that I'm trying to understand is that it will mock
interfaces, not concrete classes. I normally don't create interfaces for
every class. For example I normally don't have an interface for my business
object classes. A business object class is going to have too many unique
methods that I don't see the point of creating an interface that will only...
|
by: Nietz |
last post by:
Hi everybody, i am an user of MockPP and i like it so much, but i find
that writing mock classes quite time consuming.
So i decided to write one myself. By hacking the ABI (hacking on V-
Table), i made a library called AMOP (http://code.google.com/p/amop/)
which do not need user writing mock classes. (and any XML or Parse the
source code). You can go to the wiki and take a look of the usage.
And please give me some advices :)
|
by: Fuzzyman |
last post by:
Mock 0.4.0 has just been released, the first release in about ten
months (but worth the wait).
Mock is a simple library for testing: specifically for mocking,
stubbing and patching.
* Mock Homepage & Documentation http://www.voidspace.org.uk/python/mock.html
* mock.py (module only) <http://www.voidspace.org.uk/downloads/mock.py
* mock-0.4.0.zip (module, tests and documentation) <http://
www.voidspace.org.uk/downloads/mock-0.4.0.zip
|
by: intelrate |
last post by:
Here is a question.
I wanted my JUnit tests to be more modular and found how to mock protected methods for that purpose. Briefly speaking, we cannot mock and control calls of protected method with JDK dynamic proxy because protected methods are not in any interface but we can create MockInterface with mock method under control and call it from overridden protected method to achieve our goal.
The problem I’m trying to resolve now is that my...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|