Ive been learning MVC2 and MVVM lately and I think it works like this.
ASP.NET MVC2 - Can test the whole web site using unit tests
ASP.NET MVC2 + jquery web service calls - Can no longer just use MSTest unit test. What is the MS product to test the javascript side?
ASP.NET Webforms - Unit Tests are near impossible when the coder does...
I've got a module pagetypes.py that extracts a couple of constants (I shouldn't really use word constant here) from the db for later reuse:
def _get_page_type_(type):
return PageType.objects.get(type=type)
PAGE_TYPE_MAIN = _get_page_type_('Main')
PAGE_TYPE_OTHER = _get_page_type_('Other')
then somewhere in views I do:
import pag...
We're trying to setup controller tests for our Pylons app. I made a very simple controller and a very simple test. The tests looks like:
class TestMainController(TestController):
def test_index(self):
response = self.app.get(url(controller='main', action='index', var1 = '1'), params={'var2':'2'})
print response.req
...
Hello,
I am using Watin 2.0 to develop some automated UI tests. I cannot get Watin to close the browser after it has opened it. The Watin.Core.Browser object implements IDisposible but Dispose() does not do the trick. I have also tried using the Close() method.
Most recently I have tried wrapping the IE object instantiation in a Using ...
Following the example in PyUnit, I came up with the following unittest code that works fine.
import unittest
class Board:
def __init__(self, x, y):
self.x = x; self.y = y;
def __eq__(self, other):
return self.x == other.x and self.y == other.y
class BoardTest(unittest.TestCase):
def setUp(self):
self.b10_10 ...
I'm writing some integration tests for a Spring/Hibernate app I'm working on, and I would like to to test things with as close to real conditions as possible, which includes using Hibernate's second level cache and committing transactions.
I was wondering if there was an efficient way to ask Hibernate to delete everything from the datab...
Hi,
I am going to take part in a coding contest my University is organizining next week.
I am only allowed to use C or C++ and I would prefer to use the latter one using Visual Studio 2010.
For every task there is a text input provided as plaintext to stdin, for example:
200 100 10
2 11
I need a tool which would assist me with ...
For example, there is a interface IMyInterface, and three classes support this interface:
class A : IMyInterface
{
}
class B : IMyInterface
{
}
class C : IMyInterface
{
}
In the simplest way, I could write three test class : ATest, BTest, CTest and test them separately. However, since they support the same interface, most test code ...
I have several instances of a distributed application running on the localhost; every instance communicate with others through certain ports, all instances together make an ensemble.
(I'm actually talking about ZooKeeper, running on Linux)
Now I want to write unit tests to emulate ensemble partitioning.
E.g. I have 5 instances, and I wa...
I always learned that doing maximum code coverage whit unit tests is good. I also hear developers from big companies such as Microsoft saying that they write more lines of testing code than the executable code itself.
Now, is it really great? Doesn't it seem sometimes like a complete loss of time which has an only effect to making maint...
I'm starting to go through the questions in project Euler, and I'd like to approach it with a TDD style, but I'm having trouble finding the numeric answer to the question that doesn't include the code. Is there any resource with that data so that I can make test cases that will tell me if I've solved the problem correctly?
My motivation...
This question about unit tests sparked another thing that's been bothering me. I've gone back and forth on three ways to do unit tests when hitting a database.
Create mock objects and plug them in. This has the advantage of not needing a database, but it's time consuming and I'm not sure how much return on investment I'm getting. I've ...
An example - I want to test that the sniper notifies the view only for added items.
[Test]
public void NotifiesViewOfLoss_IfCloseEventReceivedForSnipedItems()
{
_sniper.AddItem(TestConstants.ItemNo54321);
_sniper.AddItem(TestConstants.ItemNo65432);
_sniper.AuctionClosedFor(TestConstants.ItemNo65432);
...
Hi there,
recently I made the switch to Mockito framework and am very happy with it (see also blog-post). The switch from easymock to Mockito was very straightforward and I managed to make the tests down compatible (i.e. test cases behave the same).
Do you see real reasons or shootout criteria to prefer easymock over Mockito? So far of...
Using Glib Testing framework, I would like to know if I can reuse a pointer queued to be freed with g_test_queue_free?
Here's a code sample of what I'm trying to do:
static void some_test()
{
gchar* tmp;
tmp = func_returning_gchar_ptr (...params...);
g_assert(tmp);
g_test_queue_free(tmp);
tmp = func_returning_gchar_ptr (......
Running Django unit tests is far too slow. Especially when I just want to run one test but the test runner wants to create the entire database and destroy the whole thing just for that one test.
In the case where I have not changed any of my models, I could save oodles of time if Django would not bother trying to create and destroy the...
I'm at the point where I need to write unit tests for a REST API written using CakePHP 1.3. The API supports GET, POST and PUT requests for querying and manipulating data.
Is there any established way to test the correct input/output of an API simulating an HTTP request, using fixtures? I do not want to run actual POST/PUT requests agai...
I'm using CoffeeScript in a Rails application, and I would like to unit test it. Google didn't turn up anything, is there any way to do it short of writing my own testing framework or testing the JavaScript that CoffeeScript outputs?
Thanks.
...
I am currently working on a code base, that has never had any unit tests written on it. It has been written for a 16-bit Embedded processor, and I would like to start to add unit tests for all the code that I write, at a minimum and then extend this to other parts of the code.
My problem with this is, I have found that each module (.c f...
I have a class Foo that uses another class Bar to do some stuff.
I'm trying to do test driven development, and therefore am writing unit tests for Foo to make sure it calls the appropriate methods on Bar, and for this purpose I'm using dependency injection and mocking Bar (using Rhino Mocks).
E.g. (in C#):
class Foo
{
private IBar b...