unit-testing

500 Error Running Visual Studio ASP.NET Unit Test

I have the following method in my unit test project: [TestMethod] [HostType("ASP.NET")] [UrlToTest("http://localhost:3418/Web/SysCoord/ChooseEPA.aspx")] [AspNetDevelopmentServerHost("%PathToWebRoot%")] public void TestMethod1() { Page page = TestContext.RequestedPage; Assert.IsTrue(false, "Test ra...

Which unittest framework is integrated into Visual Studio 2008

Visual Studio 2008 has built-in unittesting that was previously only available in the Team Suite editions. What unittesting framework is this based on? MbUint, MStest, xUnit or something completely different? ...

NUnit vs. MbUnit vs. MSTest vs. xUnit.net

There are quite a lot of unittesting frameworks out there for .NET. I found this little feature comparison: http://www.codeplex.com/xunit/Wiki/View.aspx?title=Comparisons Now I am to choose the best one for us. But how? Does it matter? Which one is most future proof and has a decent momentum behind it? Should I care about the features? ...

Using "friend"-declarations for unit testing. Bad idea?

[Of course, the question is not restricted to a specific "friend" implementation, feel free though to point out implementation specifics if relevant] Reading through the unanswered questions, I stumbled upon the InternalsVisibleTo attribute: Specifies that types that are ordinarily visible only within the current assembly are vi...

How do I use MSTest without Visual Studio?

Does MSTest have standalone GUI similar to nUnit that lets me use it and run test without visual studio? What is the official site for MSTest where I can learn more about how to use it? ...

How to specify a relative path for the jsUnit-ant-script?

JsUnit provides an ant-script with the target 'standalone_test'. This target uses the property url to identify the HTML-site, that executes the tests. These site is checked in, so that everyone should be able after a checkout to execute this tests. This works, but the url-proprty must be set to an absolute path, like file:///home/user/pr...

How do you measure the quality of your unit tests?

If you (or your organization) aspires to thoroughly unit test your code, how do you measure the success or quality of your efforts? Do you use code coverage, what percentage do you aim for? Do you find that philosophies like TDD have a better impact than metrics? ...

What are some of the best resources to learn MSBuild with?

I am looking for any and all suggestions of the best and effective resources that the StackOverflow community has used to better learn MSBuild with an emphasis on integrating unit tests and later static code analysis tools such as FxCop and StyleCop into the build process. I have tried to find good clear documentation on adding unit tes...

In Ruby's Test::Unit::TestCase, is there a way for a test method to access the total number of methods about to be tested?

i.e. as I compose my test suites to include other suites as well as test cases, is there a global count of how many tests the TestRunner has executed, will be executing? Any way I can progammatically access that count? ...

100% Code Coverage with logging code?

After writing new methods and unit tests for them I usually check the code coverage using the Agitar Eclipse plugin. But additionally to business logic there's a lot of logging code like: if(log.isDebugEnabled()) { log.debug("Angela Merkel is REALLY hot!"); } When Agitar checks this code, it (of course) complains about the fact, that...

How do I unit test jdbc code in java?

I'd like to write some unit tests for some code that connects to a database, runs one or more queries, and then processes the results. (Without actually using a database) Another developer here wrote our own DataSource, Connection, Statement, PreparedStatement, and ResultSet implementation that will return the corresponding objects base...

Execute only one unit test while debugging in Visual Studio 2008

Is there a way to select which TestMethods you want to execute in Visual Studio 2008 Unit Test project while debugging? I want to debug one particular test without having my other TestMethods execute during each debug session. ...

Mock File methods in .NET (like File.Copy("1.txt", "2.txt"))

We have some methods that call File.Copy, File.Delete, File.Exists, etc. How can we test these methods without actually hitting the file system? I consider myself a unit testing n00b, so any advice is appreciated. ...

What's the best way to unit test protected & private methods in Ruby?

What's the best way to unit test protected and private methods in Ruby, using the standard Ruby Test::Unit framework? I'm sure somebody will pipe up and dogmatically assert that "you should only unit test public methods; if it needs unit testing, it shouldn't be a protected or private method", but I'm not really interested in debating t...

How do I manage deployment item references that may either be on an x86 install, or x64 install for an MSTest-based project?

Much related to this question, we have a scenario on my team where we need to copy the contents of a folder for a suite of libraries and configuration files for said libraries to our folder where our test code is running from, as part of the test's deployment step. Due to the installation size, and other factors, checking in this instal...

Weird nUnit unit test failure

I have classX: Sub New(ByVal item_line_no As String, ByVal item_text As String) ' check to ensure that the parameters do not exceed the file template limits Select Case item_line_no.Length Case Is > m_item_line_no_capacity Throw New ArgumentOutOfRangeException(item_line_no, "Line No exceeds 4 characters") ...

How do you structure unit tests for cross-compiled code?

My new project is targeting an embedded ARM processor. I have a build system that uses a cross-compiler running on an Ubuntu linux box. I like to use unit testing as much as possible, but I'm a little bit confused about how to proceed with this setup. I can't see how to run unit tests on the ARM device itself (somebody correct me if I...

Tests Projects In Solution

In .NET should you place unit test projects in with the rest of the solution? Or should there be a test solution that houses all the test projects? We have all the test projects in with our code base solution...it seems a bit cumbersome. What do you usually do? ...

How can I run Test projects with Visual Studio 2008 Standard Edition?

I'm currently running Visual Studio 2008 Standard Edition and one of the items they cut out for that edition is the unit testing capability. As a result, when I open up example projects like the MVC commerce test, one of the projects just won't load since it doesn't know to open that type of project. I know I can just exclude or remove ...

Testing for assert in the Boost Test framework

I use the Boost Test framework to unit test my C++ code and wondered if it is possible to test if a function will assert? Yes, sounds a bit strange but bear with me! Many of my functions check the input parameters upon entry, asserting if they are invalid, and it would be useful to test for this. For example: void MyFunction(int para...