|
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: 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: earthwormgaz |
last post by:
Has anyone seen a tool for C++ that automatically creates mock
classes?
I found MockMaker for Java, but I wondered if there was something
similar for us C++ developers.
The idea is to read in the interface, and then spit out a version of
that that is suited to testing.
|
by: lidiriel |
last post by:
Hello,
i would like use a mock object for testing one class and its methods:
Here my class :
class Foo(Component):
def __init__(self):
self._db = self.env.get_db()
def foomethod(self, arg):
.....
|
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: 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.
|
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
|