unit-testing

generate random values for unit testing Hast table data type

My project generates few values(equal partitioning method) for each data types by getting the Minimum and Maximum values. i am doing this generating values for functional testing ,i am actually passing this values to nunit partner ,max amd min are applicable to int ,float ,double etc ..these values are test data . Initially i generat...

How will you unit test a function containing hash table data type?

My project generates a few values (equal partitioning method) for each data type by getting the minimum and maximum values. I am generating these values for functional testing, I am actually passing these values to nunit partner, max amd min are applicable to int, float, double etc.. These values are test data. Initially I generated th...

condition coverage in python

Is there any tool/library that calculate percent of "condition/decision coverage" of python code. I found only coverage.py but it calculates only percent of "statement coverage". ...

What is the best dot net unit test framework with visual studio integration?

What is the best dot net unit test framework with visual studio integration? ...

How to find unit tests not part of any suite?

With JUnit 3, if you forget to add a test to a suite, it will not get run. How can I find all JUnit test cases that are not part of our top level suite, or any suite it recursively contains? ...

Where can I find beginners video tutorials to TDD / UnitTesting using ASP.NET Webforms?

I am very interested in changing the way I tackle applications to integrate TDD / UnitTesting.. But I don't want to go down the MVC route just yet, and would like to see via Video a beginners guide to using TDD. How you set it up, use it in VS2008 etc... ...

Test writing strategy advice

So, I'm getting more and more engulfed with test driven development these days and the more code I write while thinking tdd, the more decisions it's seems as though I have to make about the extent of testing that I should write. I would like to set kind of a personal policy as to how much unit testing I should write for my own projects, ...

How to unit test asp.net mvc base controllers without hitting the database?

I have been using unit testing for controllers with the 'poor man's' dependency injection technique. Each controller inherits from a base controller to query data for the master page. How do I unit test the controller with it inheriting from base controller without hitting the database? public class HomeController : BaseController { ...

can you distinguish between a test & a variable setting?

I like doctest but when you have complex arguments that you need to set before you pass to a function it become really hard to read.. Hence, you start using multiple lines assigning then calling the function that you would like to test.. This approach however, will report that you have multiple tests rather then the real number of tests ...

How to log errors, messages in a NUnit unit test?

There are several tabs in GUI runner of NUnit: I understand that using Console.WriteLine (...) shows the messages in "Console.Out" tab. My question is what other tabs are for and how can I log messages to them? [EDIT] I apologise as I realise that my original question wasn't clear enough. What I intend to do is that create an extensi...

What is the best way to unit test a Windows CE / .NET CF app?

I want to write unit tests for an app running on Windows CE .NET Compact Framework 3.5. Ideally I'd like to deploy them and run them on the device rather than emulated for true testing but if it could also run locally in Visual Studio for speed that would be great. I am mostly writing console apps and don't care about a nice gui but it w...

PyUnit: stop after first failing test?

I'm using the following code in my testing framework: testModules = ["test_foo", "test_bar"] suite = unittest.TestLoader().loadTestsFromNames(testModules) runner = unittest.TextTestRunner(sys.stdout, verbosity=2) results = runner.run(suite) return results.wasSuccessful() Is there a way to make the reporting (runner.run?) abort after ...

Why does Assert.IsInstanceOfType(0.GetType(), typeof(int)) fail?

I'm kind of new to unit testing, using Microsoft.VisualStudio.TestTools.UnitTesting; The 0.GetType() is actually System.RuntimeType, so what kind of test do I need to write to pass Assert.IsInstanceOfType(0.GetType(), typeof(int))? --- following up, this is my own user error... Assert.IsInstanceOfType(0, typeof(int)) ...

Ruby on Rails: Running Tests

When I want to run all my unit tests, I run rake test:units. To run all my functional tests, I run rake test:functionals. If I want to run all the test cases in one file, I run ruby test/unit/username_test.rb A few people have been telling me I should run rake instead such as rake test:units TEST=test/unit/username_test.rb For runnin...

unit-testing an openGl display.

I have an openGL display that I would like to write unit-tests for. However, I'm not sure what sort of tests should be written to ensure my display is working properly? I Know I can test that the context was created successfully. But, because it is a graphical element, and working correctly is based on what is displayed, does everything ...

How to make sure that Dispose method was called on IDisposable object and if possible to integrate it into continuous integration?

Usually not calling Dispose indicates a possible error or sloppy code and may lead to some hard to find bugs. Ideally I would like to spot if Disposed was not called during unit tests. One of the methods we used was to put Debug.Assert in the Finalizer #if DEBUG ~MyClass() { Debug.Assert(false, “MyClass.Dispose() was not called”);...

How Can I Debug a Specific Rowtest?

How can I debug a specific rowtest? I'm using Visual Studio and nUnit. TDD.NET addon is great but it doesn't let me to debug a specific rowtest, before coming to my test I have to go through all previous tests. I know there are some commercial solutions for this. I'm looking for a free (or really cheap) solution. <RowTest()> _ ...

.NET: Getting the absolute path for a file when running VS Team Test

Hi all, Currently I have a test class called TestClass.cs in C:\Projects\TestProject\TestClass.cs I also have an Xml file in C:\Projects\TestProject\config\config.xml In TestClass.cs, I have a test method to load the Xml from the filesystem like so: XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(Path.Combine(Assembly.GetExecuting...

Automatic generation of Unit test cases for .NET and Java

Is there a good tool to generate unit test cases given say a .NET or Java project, it generates unit test cases that would cover an almost 100% code coverage. The number of test cases could be directly proportional to the cyclomatic complexity of the code (the higher the nesting of loops and conditions the higher the cyclomatic complexi...

How do you test code you have written yourself?

How do you effectively test code that you wrote? I find that it is very hard to tiger test code that I have written for my site because part of me feels that I don't want to find bugs in my code because that shows I'm not perfect. (Even writing that I might not be perfect bother me a little bit.) I believe in unit testing, but lately ...