I have a project full of tests, unit and integration alike. Integration tests require that a pretty large database be present, so it's difficult to make it a part of the build process simply because of the time that it takes to re-initialize the database.
Is there a way to somehow separate unit tests from integration tests and have the...
I'm looking for the best way to write unit test for code that POSTs to an external web service. The body of the POST request is an XML document which describes the actions and data for the web service to perform.
Now, I've wrapped the webservice in its own class (similar to ActiveResource), and I can't see any way to test the exact XML ...
Recently I had an interesting discussion with a colleague about unit tests. We were discussing when maintaining unit tests became less productive, when your contracts change.
Perhaps anyone can enlight me how to approach this problem. Let me elaborate:
So lets say there is a class which does some nifty calculations. The contract says t...
I have not used Unit Testing so far, and I intend to adopt this procedure. I was impressed by TDD and certainly want to give it a try - I'm almost sure it's the way to go.
Boost looks like a good choice, mainly because it's being maintained. With that said, how should I go about implementing a working and elegant file-structure and proj...
I have a class and few functions that I need to test against multiple sets of data. I load these data from flat files. I understand that I can load a file in the setUp() method and run my tests, but how do I load multiple sets of data and test the same functions against those data?
...
As a part of maintaining large piece of legacy code, we need to change part of the design mainly to make it more testable (unit testing). One of the issues we need to resolve is the existing interface between components. The interface between two components is a class that contains static methods only.
Simplified example:
class ABInte...
I have a mut.cs as follows.
using System;
namespace ns
{
public class Arith {
public int Add(int x, int y) {
return x + y;
}
public int Mul(int x, int y) {
return x * y;
}
}
}
I came up with a Unit test for this - mut_test.cs
using NUnit.Framework;
using System;
using...
Hey everyone,
I'm writing some unit tests in my project and I have a datacontext dependancy on the controller containing the methods I'd like to test.
I'm using Ninject to inject the dependancy and Moq to create my mock datacontext. My DI makes use of an interface IDataContext which my dbml impliments and is used through out the inject...
I've started using the new(ish) JUnit Theories feature for parameterizing tests. If your Theory is set up to take, for example, an Integer argument, the Theories test runner picks up any Integers marked with @DataPoint:
@DataPoint
public static Integer number = 0;
as well as any Integers in arrays:
@DataPoints
public static Integer[]...
I created an Ordered Test in Visual Studio 2008, which includes a subset of unit tests in the project.
How do I now run this Ordered Test (without running every other test).
...
I have 1 unit test method that needs several parameters. I would like to run this test once for every possible value of a cartesian with a predefined list for each parameter. I imagine that parameters could be passes in via the test context, but I do not want to connect to an external database.
For example: If I had 2 parameters with...
I have a maven project that converts text files of a specific format to another format.
For testing I have put in src/test/resources a large amount of test files.
I also have another project that uses the first one to do the conversion and then do some extra stuff on the output format. I also want to test this project against the same ...
How do I setup logging in a grails unit-test?
When I try log.info or log.debug, the .txt output files are empty, even after I tried adding a console appender. What's going on here?
...
I'm using MS UnitTesting and trying to find my way around writing my first unit tests. It seems like all my unit tests start off with creating the same few objects...
[TestMethod]
CanCreateOrder()
{
<create an order>
...
}
[TestMethod]
CanSetOrderDeliveryAddress()
{
<create an order>
<create an address>
order.Deliv...
How do you create unit tests for an Android activity that starts async tasks in onCreate? I would like to test the result of these tasks.
...
I am unit testing a class with a property whose value changes often, depending on communication it receives from another component. If the class does not receive any communication for 5 seconds, the property reverts to a default value.
It is easy for me to stub and mock out the communicating component in order to trigger the values I wa...
I'm trying to use jstestdriver to generate some unit tests in my ant build in Windows. I plan to do this by running jstestdriver from an ant target using the <java> ant task.
So far for my ant build file I have the following:
<target name="jstestdriver" description="Runs the js unit tests">
...
Now inside the <j...
I create a MOQ object
pass it to my class
call it and pass in an object.
How can I get access to this object to see if the right properties are set?
...
While trying to implement the second answer to a previous question, I am receiving an error.
I have implemented the methods just as the post shows, and the first three work properly. The fourth one (HomeController_Delete_Action_Handler_Should_Redirect_If_Model_Successfully_Delete) gives this error: Could not find a parameter named 'con...
Using C# WATIN, how do I get the value of the second occurence of a INPUT tag html element on a page?
I've tried a whole bunch of things and haven't succeeded. The debugger isn't giving me any obvious way to get element[1] among the 4 that returned.
Console.WriteLine(ie.Element(Find.ByClass("myclass")).GetAttributeValue("value") ) ;...