unit-testing

Unit test for Lucene indices

I'm working on legacy code that builds an index of popular terms in another index. There are no unit tests in place, and the indexing process is a pain to wait for because the first index takes so long to build. I want to structure the second (popular term) index differently. Is there a best practice for testing to see if a Lucene inde...

How Do I Unit Test Silverlight 3 in VS2010?

I am currently working on a project that uses the Silverlight 3 SDK and I want to create unit tests for my Silverlight code. I want these tests to not have to run in a browser context. I have referenced the Silverlight Unit Testing binaries that come in the SDK (Microsoft.Silverlight.Testing and Microsoft.VisualStudio.QualityTools.UnitTe...

What's the point of ordered unit tests in Visual Studio?

In my test list, my ordered test appears and runs, but each individual test that composes the ordered list is run a second time outside the list if I run all the tests. What is the point of the ordered list if it's going to run them nondeterministically as well? Am I missing something? ...

Trouble with OCUnit - Instantiating custom data type

Hi, I have successfully set up unit testing for an XCode version 3.2.2 project with the iPhone SDK version 3.1.2. I have created a class, "Callout" which I am attempting to instantiate within the context of a unit test. The class has a method, -(id) initWithDictionary:(NSDictionary*)calloutDict includesSong:(BOOL)hasSong lastUpdate:(N...

Mocking urllib2.urlopen and lxml.etree.parse using pymox

I'm trying to test some python code that uses urllib2 and lxml. I've seen several blog posts and stack overflow posts where people want to test exceptions being thrown, with urllib2. I haven't seen examples testing successful calls. Am I going down the correct path? Does anyone have a suggestion for getting this to work? Here is what...

How to Profiler unit test in Visual Studio 2010?

Can I use VS 2010 Profiler to profile unit test (MSTest)? If yes, how? Thanks, Michael ...

jUnit 4 DirectorySuiteBuilder Equivalent

I'd like to know if there is something similar to junit-addons DirectorySuiteBuilder (documentation) that works with jUnit 4. Simply stated, I want to load every file name *Test.java in a directory and build a suite out of them. I realize that I can build a suite that runs every test in a directory using ant, but I would prefer to not ...

Naming convention JUnit suffix or prefix Test

Class under test MyClass.java JUnit test case name alternatives: TestMyClass.java MyClassTest.java http://moreunit.sourceforge.net seems to use "Test" as prefix default but I have seen both uses. Both seems to be recognized when running the entire project as unit test in eclipse as it is the annotation inside classes that are parsed ...

Suggestions for a java Mock File (to mock java.io.File)

Does anyone have suggestions for a java mock File object? I Am using a thirdparty class which need to get a java.io.File object as argument. I receive the data for this file in a stream over a webservice (also one of their products). One solution is to write all this data to a file and offer this to the class. This is a solution I don't...

Starting with a simple unit test in c

Hi, I was told by my boss to write unit tests for the little c file (foo.c) I wrote. I read a lot about the background of unit testing online, like testing only one function and making tests fully automated, but I did not find any tutorial about how to implement an actual unit test. I tried the following approach, but failed. /*f...

Integration QtTest (unit-tests) into NetBeans (latest 6.9)

Latest NetBeans have new feature for C++ programming -- integrated unit-tests. But for now there is only CppUnit which are quite awkward and yet more weird one named "Simple Test" Is it possible that somebody already know how to add such support for Qt's QtTest module? Or may be know ease way to add other unit-test support to NetBeans...

How should I go about mocking calls to XSD data access?

Hey guys I'm trying to introduce Unit testing and TDD into my code (working as one of a team within a large pre-existing project). The project I'm working on uses XSDs to do a lot of the data access (often with no abstraction, i.e. database calls from the .aspx.cs pages, which is another issue I wish to address at some point). My ques...

Which testing tools do what in Ruby?

What I mean by that is, which tools are for unit testing, which for BDD, is there even a clear divide? I'm just learning Ruby from C#, and the tools I'm familiar with there are xUnit-style for pure unit testing/TDD, and Cucumber/SpecFlow for BDD/integration testing. Of course, you can use unit testing tools for integration testing if y...

Unit testing various foreach of some inputs

Especially for C# Unit Testing, how to make a test run for various inputs or an input matrix? I very often have the case of unit tests making a matrix of inputs, but usually it can be reasonably solved by checking a list of inputs. The simplest case is testing the addition: 0 + 0 = 0 1 + 0 = 1 0 + -1 = -1 1 + -1 = 0 The same tests ...

What unit testing tools should I use for Silverlight 4?

I'm starting up a brand new project using VS2010 and Silverlight 4. This is my first Silverlight project and I'm at a loss as to what tools I should use for both mocking and unit testing. There's Rhino.Mocks 3.5 for Silverlight, but the author marked it as an alpha release. Moq claims Silverlight support, but I've not used it before. ...

Google Test: Parameterized tests which use an existing test fixture class?

I have a test fixture class which is currently used by many tests. #include <gtest/gtest.h> class MyFixtureTest : public ::testing::Test { void SetUp() { ... } }; I would like to create a parameterized test which also uses all that MyFixtureTest has to offer, without needing to change all my existing tests. How do I do that? I hav...

Using MbUnit with Delphi Prism

I have created below simple testcase in Delphi Prism. When I run the testcase using Gallio Icarus, it returns a This test is not supported by any available test framework. I can think of only two reasons why this might be happening I am missing something (really) obvious. A setting, a missing initialization somewhere, ... It is not po...

OCUnit will not allow me to use my own data types

Hi, I am using XCode 3.2.2 to unit test some custom data types. The tests run properly without those data types, but when I use said data types, I get this error: "_OBJC_CLASS_$_classname", referenced from: (where "classname" is the, well, class name...) I have seen hints online that it could be linker related. The strange thing is, ...

unmount fuse fs from python script

I have developed fuse fs with python and now want to write tests for it. Before testing I mount fs to some dir: fs = MyFuseFS() fs.parse(errex=1, ['some_dir']) fs.main() After testing I want unmount my fs, want to do something like this: fs.unmount() Is it something like "unmount" method? Maybe there is another ways...

how to add dozen of test cases to a test suite automatically in python

Hi All, i have dozen of test cases in different folders. In the root directory there is a test runner. unittest\ package1\ test1.py test2.py package2\ test3.py test4.py testrunner.py Currently I added the four test cases manually into a test suite import unittest from package1.test1 import Test1 from package1....