Is there any tangible value in unit testing your own htmlhelpers? Many of these things just spit out a bunch of html markup - there's little if no logic. So, do you just compare one big html string to another? I mean, some of these thing require you to look at the generated markup in a browser to verify it's the output you want.
Seems a...
Michael Feathers, in Working Effectively With Legacy Code, on pages 13-14 mentions:
A unit test that takes 1/10th of a
second to run is a slow unit test...
If [unit tests] don't run fast, they
aren't unit tests.
I can understand why 1/10th a second is too slow if one has 30,000 tests, as it would take close to an hour to run....
[Test]
public void A()
{
var d = Dispatcher.CurrentDispatcher;
Action action = () => Console.WriteLine("Dispatcher invoked me!");
var worker = new BackgroundWorker();
worker.DoWork += SomeWork;
//worker.RunWorkerAsync( (Action) delegate { Console.WriteLine("This works!"); } );
...
Assume i have a private routine that performs some calculation:
private function TCar.Speed: float
{
Result = m_furlogs * 23;
}
But now i want to begin testing this calculation more thoroughly, so i refactor it out to a separate function:
public function TCar.Speed: float
{
Result = CalculateSpeed(m_furlogs);
}
private functio...
I have created a silverllight unit test page and it has the reference to both Silverlight.Testing and ...UnitTesting.Silverlight. I have reference to both of them in my test project as using as well.
When I tried to do EnqueueDelay(1000), VS does not recoganise this as a valid method call. What am I doing wrong?
Thanks,
...
I tried to run the example from the following link
http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.expectedexceptionattribute.aspx
expecting the test to pass, but the test is failing with the same error. Is there something I am missing?
Thanks,
...
I am using Selenium RC for website testing and I need to use multiple proxies at once and am doing this using: firefoxProfileTemplate when I start the selenium server. This, however, doesn't allow me to multi-thread selenium as each selenium object still uses the same firefoxProfileTemplate, and therefore the same proxy, (I am using Pyth...
I have been searching for a good way to run JavaScript unit tests inside of the Visual Studio 2010 IDE. I currently use TestDriven.net to run my C# units tests and it is very convenient to be able to quickly get the result of my tests in the output pane. I would love to find a similar experience for JavaScript (ideally working with Test...
Hi there,
I'm trying to write some unit tests for my controllers in a Spring MVC web app. I have already got a fairly comprehensive set of unit tests for the domain model, but for completeness I want to test the controllers too.
The issue I'm facing is trying to test them without loading a Spring context. I thought I could get around...
I have a following method which takes a XDocument, iterates through the nodes and remove/replace nodes based on some condition.
public static void Format(XDocument xDocument)
{
foreach(XmlNode documentNode in xDocument)
{
XmlNode[] spanNodes =documentNode.SelectNodes("//span") ;
foreach(XmlNode spanNode in span...
This problem doesnt occur in all projects, hence it makes it even more frustrating.
If I click on a Private method to create a unit test, it would generate a TestProject assembly and create a predefined class in there. It woudl also create a Accessor for that class.
[TestMethod()]
[DeploymentItem("xxx.Client.dll")]
pub...
I have to unit test a method of a groovy class which uses sleep() to delay processing in a loop.
Obviously I don't want my test suite to sleep really, so I tried to mock the sleep() call in my class:
MyClass.metaClass.sleep = { return }
I tried a few variations of this with no success.
Can someone tell me the correct way to mock thi...
Hello, I am new to unit testing.
I was trying to run a simple unit test in Visual Studio 2008. The code I was testing uses a third party library. When I try to run the test, following error occurred.
"Warning: Test Run deployment issue: The assembly or module 'nunit.framework' directly or indirectly referenced by the test container ......
Suppose I have the following code in a Python unit test:
aw = aps.Request("nv1")
aw2 = aps.Request("nv2", aw)
Is there an easy way to assert that a particular method (in my case aw.Clear()) was called during the second line of the test? e.g. is there something like this:
#pseudocode:
assertMethodIsCalled(aw.Clear, lambda: aps.Request...
I'm writing unit tests in Python for the first time, for a Django app. I've struck a problem. In order to test a particular piece of functionality, I need to change the value of one of the app's settings. Here's my first attempt:
def test_in_list(self):
mango.settings.META_LISTS = ('tags',)
tags = Document(filepath).meta['tags']...
Hello!
I get a strange error when Im trying to unit test a Java class dealing with JSF components (javax.faces.model.SelectItem). The error I get is this:
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/model/SelectItem
at java.lang.ClassLoader.defineClass1(Na...
I have the following in my pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<excludes>
<!-- exclude integration tests -->
<exclude>**/IT*.j...
Hi Everyone,
I am writing a program that runs some unit tests on code that that been written by my colleagues. I am using the Google C++ testing framework. I run a function that spawns 3 threads, and then runs for 30 seconds. After it runs, the program exits with status 0. This is not the expected behavior, obviously. I know it doesn't ...
Since the datastructure of my application domain is becoming pretty complex as of late, I started reading up on mock objects. Soon a simple question came to my mind, but the answer has proven to be quite the headache so far. So here goes:
We have a class 'Foo' with 'bar' as one of its methods:
class Foo {
public String bar(int i){
...
I am assuming that as the code is standard C#, I can just use nUnit, TestDriven.net etc.
Have I missed something?
What “traps” have other people hit trying to do this?
...