unit-testing

What will we use Theory Attribute for ?

I discovered [Theory] and [Datapoint] attributes in NUnit. I am not very sure about how should I use these. I think they can be used for data-driven testing and this has got me interested. There aren't many resources available on the same. Can someone explain to me how to use them or point me to resources? Thanks. ...

Writing tests for DAOs

I'm currently assigned to write a test for a project, is it necessary to write tests for DAO classes? ...

Ordering test according to when they were executed in Visual Studio

We are using Visual Studio 2008. We have a solution with ca. 1000 tests. We run the tests from a script which produces a trx file. Two of our tests timeout, due to what looks like a database lock. When we run the tests alone, they run fine. How can we findout which tests were run just before the ones that are getting the timeout? ...

Are there any test data generator tools which can be used with selenium/Nunit?

Hi, I was wondering if there was anything that provides test data for injecting into Nunit tests? I'm sure I came across something recently that does this but I couldn't find it again. Basically the idea is that I could use selenium and Nunit to create new customers within the system automatically. So I could have selenium type in cust...

Perfom python unit tests via a web interface

Is it possible to perform unittest tests via a web interface...and if so how? EDIT: For now I want the results...for the tests I want them to be automated...possibly every time I make a change to the code. Sorry I forgot to make this more clear ...

How to get started with testing(jMock)

Hello, I'm trying to learn how to write tests. I'm also learning Java, I was told I should learn/use/practice jMock, I've found some articles online that help to certain extend like : http://www.theserverside.com/news/1365050/Using-JMock-in-Test-Driven-Development http://jeantessier.com/SoftwareEngineering/Mocking.html#jMock And most ...

How to test a call to setContentView?

How do I write a unit test to determine that the layout used in setContentView(int layoutId) has been called and corresponds to the proper layout for a given activity? ...

TDD, Unit Test and architectural changes

I'm writing an RPC middleware in C++. I have a class named RPCClientProxy that contains a socket client inside: class RPCClientProxy { ... private: Socket* pSocket; ... } The constructor: RPCClientProxy::RPCClientProxy(host, port) { pSocket = new Socket(host, port); } As you can see, I don't need to tell the user that I...

Problem with Unit testing of ASP.NET project (NullReferenceException when running the test)

Hi, I'm trying to create a bunch of MS visual studio unit tests for my n-tiered web app but for some reason I can't run those tests and I get the following error - "Object reference not set to an instance of an object" What I'm trying to do is testing of my data access layer where I use LINQ data context class to execute a cert...

Where should test classes be stored in the project?

I build all my web projects at work using RAD/Eclipse, and I'm interested to know where do you guys normally store your test's *.class files. All my web projects have 2 source folders: "src" for source and "test" for testcases. The generated *.class files for both source folders are currently placed under WebContent/WEB-INF/classes fold...

Boost.Test: Looking for a working non-Trivial Test Suite Example / Tutorial

The Boost.Test documentation and examples don't really seem to contain any non-trivial examples and so far the two tutorials I've found here and here while helpful are both fairly basic. I would like to have a master test suite for the entire project, while maintaining per module suites of unit tests and fixtures that can be run indepen...

How to specify the location for the unit test results in VS 2010?

I use VS2010 for unit testing. Does anyone know how to specify the location of where VS 2010 put its TestResults? By default it put a TestResults folder in the solution folder, I'd like to move it out somewhere else. Thanks, Ray. ...

Including uncovered files in Devel::Cover reports

I have a project setup like this: bin/fizzbuzz-game.pl lib/FizzBuzz.pm test/TestFizzBuzz.pm test/TestFizzBuzz.t When I run coverage on this, using perl -MDevel::Cover=-db,/tmp/cover_db test/*.t ... I get the following output: ----------------------------------- ------ ------ ------ ------ ------ ------ File ...

Using jmock how to reuse parameter

I'm building a test, in wich i need to send question, and wait for the answer. Message passing is not the problem. In fact to figure out wich answer correspond to wich question, i use an id. My id is generated using an UUID. an i want to retrieve this id, wich is given as a parameter to a mocked object. It look like this: oneOf(messag...

Visual Studio 2010 Code Coverage - Cannot find the back up file, created by instrumentation utility

I am trying to run code coverage in VS 2010 and I am running into the following error. No coverage information is generated. Code coverage in-place instrumentation: Cannot fully backup the binary 'MyProject.dll'. Cannot find the back up file, created by instrumentation utility: 'MyProject.dll.orig'. ...

C# / Visual Studio: production and test code placement

Hi, In JavaLand, I'm used to creating projects that contain both production and test code. I like this practice because it simplifies testing of internal code without artificially exposing the internals in a project's published API. So far, in my experiences with C# / Visual Studio / ReSharper / NUnit, I've created separate projects (i...

Generic unit test scheduling

Hello, I'm (re)writing a program that does generic unit test scheduling. The current program is a mono-threaded Perl program, but I'm willing to modularize it and parallelize the tests. I'm also considering rewriting it in Python. Here is what I need to do: I have a list of tests, with the following attributes: uri: a URI to test (c...

Difference in techniques for setting a stubbed method's return value with Rhino Mocks

What is the main difference between these following two ways to give a method some fake implementation? I was using the second way fine in one test but in another test the behaviour can not be achieved unless I go with the first way. so (the first), using (test.Record()) //test is MockRepository instance { service.GetUser("dummyName"...

Need help with writing test

I'm trying to write a test for this class its called Receiver : public void get(People person) { if(null != person) { LOG.info("Person with ID " + person.getId() + " received"); processor.process(person); }else{ LOG.info("Person not received abort!"); ...

How to Return Variable for all tests to use Unittest

Hello, I have a Python script and I am trying to set a variable so that if the first test fail's the rest of then will be set to fail. The script I have so far is: class Tests(unittest.TestCase): def result(self): ....This function does something[ignore]...... someArg = 0 def testPass(self): try: ...