473,543 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

avoiding long startup time in unit testing

There are situations in which you have to setup a faily sophisticated
environment before running your tests. This may result in a long
startup
time. In my case (using PloneTestCase) the time taken to import all
the
needed libraries, create a plone site and set up the environment, is
so
long that practically I cannot use my good old Pentium II for running
the test cases. Notice that the problem is not in the time spent on
the
tests which is really marginal (I typically run only one or two tests,
I am not talking about running the full test suite), it is all startup
time. This is terrible for me since I usually run the tests often
(say every minute) and if I have a minute of startup time at each run
my productivity is cut in half. It is essentially the same feeling
that
using a compiled language :-(

So, you could tell me "Why don't you use your newer, much faster
laptop
and you are done with it?". The answer is that I have a special
affection
for my old laptop ;) I did a lot of Python work with it and it is
still
fast enough for most applications.

The problem is with the testing framework. If I am just fixing a
misprint in my test case I don't want all the plone site to be
recreated from zero, I want just to re-run the fixed test. For
instance, I would like to highlight the given test with Emacs and
run it, without recreating the site each time.

I did some experiment hacking unittest and I can get something
interesting,
such as a command-line interface where you initialize the stuff only
once,
you reload the module you want to test, and you run the tests for that
module.

However, this is a hack, and I don't know how much robust it is
(probably not
very). I wonder and I ask here on the mailing list if there is already
some
testing framework that does what I am talking about.
I am interested in something general, not necessarely related to
Zope/Plone.
Thanks,

Michele Simionato
Jul 18 '05 #1
1 1395
"Michele Simionato" <mi************ ***@gmail.com> wrote in message
news:4e******** *************** ***@posting.goo gle.com...
There are situations in which you have to setup a faily sophisticated
environment before running your tests. This may result in a long
startup
time. In my case (using PloneTestCase) the time taken to import all
the
needed libraries, create a plone site and set up the environment, is
so
long that practically I cannot use my good old Pentium II for running
the test cases. Notice that the problem is not in the time spent on
the
tests which is really marginal (I typically run only one or two tests,
I am not talking about running the full test suite), it is all startup
time. This is terrible for me since I usually run the tests often
(say every minute) and if I have a minute of startup time at each run
my productivity is cut in half. It is essentially the same feeling
that
using a compiled language :-(

So, you could tell me "Why don't you use your newer, much faster
laptop
and you are done with it?". The answer is that I have a special
affection
for my old laptop ;) I did a lot of Python work with it and it is
still
fast enough for most applications.

The problem is with the testing framework. If I am just fixing a
misprint in my test case I don't want all the plone site to be
recreated from zero, I want just to re-run the fixed test. For
instance, I would like to highlight the given test with Emacs and
run it, without recreating the site each time.

I did some experiment hacking unittest and I can get something
interesting,
such as a command-line interface where you initialize the stuff only
once,
you reload the module you want to test, and you run the tests for that
module.

However, this is a hack, and I don't know how much robust it is
(probably not
very). I wonder and I ask here on the mailing list if there is already
some
testing framework that does what I am talking about.
I am interested in something general, not necessarely related to
Zope/Plone.
Well, that's good because I can't talk about Zope/Plone. The best
answer I have is the standard answer from XP:

Use mock objects and simulators to make your unit tests run
fast, and then run them again (possibly overnight) with the full
production environment to insure that your mocks and simulators
didn't cover up anything.

The other thing is that it isn't that unusual to hack unittest (jUnit,
etc) to initialize a hard-to-initialize resource at the beginning of
a test run and reuse the initialized resource for all the tests. It's
not ideal because it can create hard to find inter-test dependencies,
but sometimes it's necessary to get the most tests running in the
shortest possible time.

John Roth
Thanks,

Michele Simionato

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

83
3373
by: kartik | last post by:
there seems to be a serious problem with allowing numbers to grow in a nearly unbounded manner, as int/long unification does: it hides bugs. most of the time, i expect my numbers to be small. 2**31 is good enough for most uses of variables, and when more is needed, 2**63 should do most of the time. granted, unification allows code to work...
11
2306
by: rhat | last post by:
Hi Everyone, I've recently been reading some articles about unit-testing in Python , but I am a bit confused: where do I go to get started with this? I tried googling for "unittest" but all I've found are some old links to projects that already use it, and the older (as the articles put it) PyUnit project. I'm sorry if this is a obvious...
1
1310
by: esther | last post by:
I'm working on my monthly column for Software Test & Performance magazine, and I'd like your input. The topic, this time around, is unit testing (using python or anything else). Care to share some of your hard-won knowledge with your peers? In particular, what I'm looking for are experiences and advice about _developing_ the unit tests....
1
1408
by: Jesper Dk | last post by:
Hi, I need to invoke a program when the commands the computer to logs of or shut down. Is there an equivalent to the startup folder for this purpose. Best regards Jesper.
4
2148
by: Peter Rilling | last post by:
Does VS.NET 2005 Professional support integrated unit testing, or is that only with the team system?
72
5160
by: Jacob | last post by:
I have compiled a set og unit testing recommendations based on my own experience on the concept. Feedback and suggestions for improvements are appreciated: http://geosoft.no/development/unittesting.html Thanks.
4
18950
by: Dat AU DUONG | last post by:
Hi, I am new to Unit testing, could you tell me where I could find information (hopefully step by step) and what is the benefit of unit testing. I am a sole developer in a company, therefore I don't get expose to much of this technology. Thanks in advance. Regards Dat.
18
7098
by: Zytan | last post by:
I just got a TypeInitializationException exception. Why it is a common cause for this? The InnerException is System.FormatException, although I don't see anything requesting something to be formatted. I'm trying to invoke the use of a class, to force its static c'tor to run, which will run its unit test. Is there a good way to force all...
5
2230
by: Ben Finney | last post by:
Howdy all, PEP 299 <URL:http://www.python.org/dev/peps/pep-0299details an enhancement for entry points to Python programs: a module attribute (named '__main__') that will be automatically called if the module is run as a program. The PEP has status "Rejected", citing backward-compatibility issues, and Guido's pronouncement that "It's not...
0
7412
marktang
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...
0
7594
Oralloy
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. ...
1
7356
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...
0
7697
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5892
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5285
isladogs
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...
0
3395
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...
1
1830
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
979
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.