Hi there,
I use Visual Studio 2005, c# projects...
I like the new unit test framework very much, it helps a lot mantaining and
growing up a project with the test driven paradigm, that's so good!
I'm looking for a way to detect if the program is running under the TEST
enviroment or running normally, let's say I need something like
#if TESTING
do some stuff...
#endif
or, I don't know what else... something that comes from the framework, I
don't want to set the TESTING by myself like DEBUG / TRACE in the compiler
configuration options...
any idea ?
Thanks, Davide. 3 5400
Ing. Davide Piras <da****@naxosoftware.comschrieb:
I'm looking for a way to detect if the program is running under the TEST
enviroment or running normally, let's say I need something like
#if TESTING
do some stuff...
#endif
You don't want to do that, because it completely defeats the purpose
of the tests. You'll introduce bugs that the testing framework will
not find.
Markus
Thank'you Markus, I think you are right, but probably there are some cases
where a swithc could help...
we develop a web application, for instance, we test the debug version in the
local machine then we deploy the release version on the remote server, the
remote server has SMTP on 127.0.0.1, the local machine has not
so, I would like to skip only the last code line (the mail sending action)
in the test case and still return true so the test is passed, the critical
code that could crash and should be tested is before!!!!
.... even if I'd a mail server on my computer, there is not point to send
email while testing !!
any idea ?
thanks, Davide.
"Ing. Davide Piras" <da****@naxosoftware.comwrote in message
news:uF**************@TK2MSFTNGP06.phx.gbl...
Thank'you Markus, I think you are right, but probably there are some cases
where a swithc could help...
we develop a web application, for instance, we test the debug version in
the local machine then we deploy the release version on the remote server,
the remote server has SMTP on 127.0.0.1, the local machine has not
so, I would like to skip only the last code line (the mail sending action)
in the test case and still return true so the test is passed, the critical
code that could crash and should be tested is before!!!!
... even if I'd a mail server on my computer, there is not point to send
email while testing !!
any idea ?
The whole idea of testing is that making your code testable is what improves
the quality of your code. Without seeing the code I can only guess at what
is happening. You seem to be accessing some SMTP object that sends an email
and return true to indicate success. Make this SMTP object a parameter and
pass in a mock SMTP object that does nothing when SendMail() method is
called and returns true.
PS This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Woojay Jeon |
last post by:
OK, I tried a Google search on this Usenet group but couldn't find a
solution, so I'm posting my question here (if there's a better archive than
the one in Google, please let me know).
Does...
|
by: |
last post by:
Hi!
I'm looking for unit-testing tools for .NET.
Somthing like Java has --> http://www.junit.org
regards,
gicio
|
by: |
last post by:
I am working on a web/webservice application that has a service layer. Most
service methods will perform an access-check before executing. This check
uses the IPrincipal credentials available in...
|
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:
...
|
by: shuisheng |
last post by:
Dear All,
I was told that unit test is a powerful tool for progamming. If I am
writing a GUI code, is it possible to still using unit test?
I have a little experience in using unittest++. But...
|
by: rich_sposato |
last post by:
I released version 2.0 of C++ Unit Test Library. You can download
it from SourceForget.Net at http://sourceforge.net/projects/cppunittest/
..
I wrote this unit test library because other unit...
|
by: brad |
last post by:
Does anyone else feel that unittesting is too much work? Not in general,
just the official unittest module for small to medium sized projects?
It seems easier to write some quick methods that are...
|
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...
|
by: Steve |
last post by:
Hi guys,
I have a test solution (called TP2) which is checked in to a Team
Project (also called TP2). The solution contains:
* DLL (containing a single test class)
* Unit Test project (which...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |