I'm working on a DAL method that uses an ORDER BY clause in a SELECT. The return value from the method is an IEnumerable<T>, where T is a class that encapsulates a domain entity, and the sort order would be based on one of the properties of this class, namely, "Priority." It's important that this ORDER BY works, of course, so I want to...
Hello,
I have a simple project, mostly consisting of back-end service code. I have this fully unit-tested, including my DAL layer...
Now I have to write the front-end. I re-use what business objects I can in my front-end, and at one point I have a grid that renders some output. I have my DAL object with some function called DisplayReco...
I'm writing tests using the unittest package, and I want to avoid repeated code. I am going to carry out a number of tests which all require a very similar method, but with only one value different each time. A simplistic and useless example would be:
class ExampleTestCase(unittest.TestCase):
def test_1(self):
self.assertEq...
I am using TestUnit and would like to determine if a function is called. I have a method in a class called Person which I set to be called 'before_update':
def geocode_if_location_info_changed
if location_info_changed?
spawn do
res = geocode
end
end
end
Then I have a unit test:
def test_geocode_if_locat...
So I'm starting to write a class library of useful methods I've written and picked up over the years, I'll start with two examples of code, then ask my specific questions:
I'd also like to make the argument that this is not a duplicate of some of the other, "where do I start unit testin questions."
Check network connectivity (not inter...
Hello,
I'm new to Nunit testing and I wanted to test the following constructor:
public class IngredientDAONHibernate : NutritionLibrary.DAO.IngredientDAO
{
private Configuration config;
private ISessionFactory factory;
public IngredientDAONHibernate()
{
try
{
...
Sorry for the repost.
I'm using Nhibernate for ORM and have this class I need to perform unit tests using Nunit:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Cfg;
using NutritionLibrary.Entity;
using System.Data;
using System.Data.SqlClient;
using System.Collec...
I would like to perform a unit test in Silverlight, with VB.net.
I have read an example of how to perform an asynchronous test (http://jonas.follesoe.no/UnitTestingAsynchronousSilverlightCode.aspx), but I do not know how to translate the following from C# to VB.net:
EnqueueCallback(() => Assert.AreEqual(value, expectedValue));
Can s...
Is there a simple (Attribute-driven) way to have the following test fail on the message of the exception.
[TestMethod()]
[ExpectedException(typeof(ArgumentException))]
public void ExceptionTestTest()
{
throw new ArgumentException("BBB");
}
I would Like to have the test pass if the message in the exception is BBB , but fail if it i...
Hi,
We write a lot of integration tests that work quite well for us, we did attempt to introduce unit testing but found it more difficult to introduce as it took longer and the benefits were not that apparent.
We still have testers manually going through test scripts. We still have a long way to go to automate our testing process and w...
I've a SecurityService that has a AutoLogin method, that uses the ServiceSecurityContext to find out which windows identity is calling and then tries to find the related user account in the database. This is working fine when it is called from a web site that uses impersonation and requires integrated security in IIS. The call is using t...
I am looking at moving from NUnit to MbUnit for my unit testing framework as it has a couple of features that I like, one of them being the parallelizable attribute. If I mark tests with this attribute what happens
i, are all instance variables available only to their own thread or are they shared?
ii, how many tests will execute at on...
Hi,
I use DbUnit to load data into a DB for some integration tests. The data is specified in a flat XML file like so:
<user id="2" name="bob" type="user">
<user id="1" name="john" type="admin">
However in the case of one table, the rows I wish to insert are based on rows already inserted into other tables. The most convenient way for...
I'm currently developing two Java networking applications for school projects. One over TCP and the other one over UDP. In both I have to implement simple custom protocol.
Even though I'm trying pretty hard, I can't find a way how to correctly test this kind of apps, or better develop with test first development.
If I have a client and...
I'm developing a Visual Studio Integration Package. When I try to run the Unit Tests that are included in the unit test project that is included in the template I get the following failure on the first test:
The test adapter 'VsIdeHostAdapter'
threw an exception while running test
'MenuItemCallback'. Call was rejected
by calle...
I have a method which calls for a classmethod of another class
def get_interface_params_by_mac(self, host, mac_unified):
lines = RemoteCommand.remote_command(host, cls.IFCONFIG)
...
class RemoteCommand(object):
@classmethod
def remote_command(cls, host, cmd, sh = None):
...
I'm going to write a unit test for *g...
How would you check the parameters on a function that accepts a Dictionary?
IDictionary<string, string> someDictionary = new Dictionary<string, string> {
{"Key1", "Value1"},
{"Key2", "Value2"}
};
Expect.Call(delegate {someService.GetCodes(someDictionary);}).Constraints(...);
Basically, I want to verify that the parameter for GetC...
it's good practice to write Unittests to
be independed of the whole spring application context
automate the test you are doing for continuous integration
avoid dependency on the Servlet Container
I guess with JRebel there's a temptation to test everything in the running application and 'forget' to write Unittests. What's your expe...
Hi all:
I'm currently trying to mock the following method using Jack. The code example is as below:
var ID = "id";
$('#' + ID + ' > div > table').each(function) {
var nodeSpan = $(this).find('span.' + NODE_INDICATORS)[0];
.
.
.
});
How should I approach it? Are there jQuery/QUnit functions that allows me to create a DOM node/el...
We have a python based web application along with its unit test cases. Our need is to automate the process of running unit test cases. They should run either after every checking OR after every fixed time interval. With minimal effort and time what is best tool that we can use to automate this process. We are using Linux as OS and git as...