For example, when these tests are run, I want to ensure that test_fizz always runs first.
require 'test/unit'
class FooTest < Test::Unit::TestCase
def test_fizz
puts "Running fizz"
assert true
end
def test_bar
puts "Running bar"
assert true
end
end
Update: Why do I want to do this? My ...
Hi! I got the following error message:
System.IndexOutOfRangeException: Invalid index 9 for this SqlParameterCollection with Count=9..
And I absolutely wonder why oO?!
The database schema and the hbm.xml files were all correctly created with FluentNHibernate.
The error ocurrs in the CanCorrectlyMapBookmethod, the PersistenceSpecifica...
I have a functional test that is supposed to call ROTS (Ruby Openid Test Server) to act as an identity.
In my UsersControllerTest, I have the following:
test "creating a user" do
get :create, :user => {
:username => "woot",
:email => "[email protected]",
...
I have come to something of a crossroads. I recently wrote a 10,000 line application with no TDD (a mistake I know). I definitely ran into a very large amount of errors but now I want to retrofit the project. Here is the problem I ran into though. Lets take a example of a function that does division:
public int divide (int var1, int var...
Hi!
I have two problems.
1 . FNH does not test my component correcty and I dont know why.
System.ApplicationException: Expected
'DomainModel.Model.Publisher' but got
'DomainModel.Model.Publisher' for
Property 'Publisher'.
[TestMethod]
public void CanCorrectlyMapBook()
{
new PersistenceSpecification<Book>(_session)
...
I am currently using the standard Microsoft Unit Test suite in VS 2008. ReSharper 4.5 is also installed. My unit tests rely on an TestInitialize method which pre-loads a data file. The path to this test data file will differ depending on if I run the unit test from within VS 2008 using the standard Ctrl-R + Ctrl-T command versus the R...
I'm writing a plugin that adds a class method to ActionController::Base, so in my functional test I am creating a simple controller to test against. The example below is totally stripped down to basically do nothing. The test succeeds all the way up to assert_template, which fails.
require 'rubygems'
require 'test/unit'
require 'active_...
I have an interface with a method that expects an array of Foo:
public interface IBar {
void DoStuff(Foo[] arr);
}
I am mocking this interface using Mockito, and I'd like to assert that DoStuff() is called, but I don't want to validate what argument are passed - "don't care".
How do I write the following code using any(), the gener...
I know that Microsoft and MvcContrib have made great attempts at enabled developers to unit test controllers. But lately I've been wondering if we should ditch unit testing controllers, and leave them for integration testing. I have two reasons for this:
A good controller should not have any logic in it, or very basic minimal logic. ...
I am trying to get some unit tests for native C++ running with Visual Studio Test Suite. I have just a single, simple class named "Shape". I followed a tutorial and did the following steps:
Created a "ref class" wrapper called "MShape" for the native class I want to test
Changed configuration type to .dll
Changed CLR support to /CLR
Se...
Using the Show/Remove Columns context menu option in the Test Results window I can show the Class Name column. However, when I then close and reopen Visual Studio 2008 the Class Name column is not longer there.
How do I permanently display the Class Name column?
EDIT: I started this edit thinking I'd found the reliable way to reproduc...
Hi,
I am using Visual Studio 2008 for a C# WinForms application and I am using the MSTest unit testing framework. It doesn't seem to have test coverage (I think it's in Team System?).
What is the easiest (cheapest?) way to get some test coverage statistics for my project here? Effectively just an indication of for each *.cs file the...
I am writing unit tests for a project in ASP.NET MVC 1.0 using Moq and MvcContrib TestHelper classes. I have run into a problem.
When I come to Roles.AddUserToRole in my AccountController, I get a System.NotSupportedException. The Roles class is static and Moq cannot mock a static class.
What can I do?
...
I'm writing some NUnit tests for database operations. Obviously, if Add() fails, then Get() will fail as well. However, it looks deceiving when both Add() and Get() fail because it looks like there's two problems instead of just one.
Is there a way to specify an 'order' for tests to run in, in that if the first test fails, the following...
Say we have this hyper simple class hierchy:
public class SomeMath
{
public int Add(int x, int y)
{
return x + y;
}
}
public class MoreMath : SomeMath
{
public int Subtract(int x, int y)
{
return x - y;
}
}
Should I write tests for the Add method when I write tests for the MoreMath class? Or sh...
I have a controller action that automatically redirects to a new page if the user is already logged in (User.Identity.IsAuthenticated). What is the best way to write a unit test for this scenario to ensure that the redirect takes places?
...
I have never used unit testing before, so I'm giving CxxTest a go. I wrote a test to check if a function correctly sorts a std::vector. First I made sure the test failed when the vector wasn't sorted, and then as a sanity check I tested whether std::sort worked (it did, of course). So far, so good.
Then I started writing my own sorting ...
Can you separate components of an IceFaces application so they can be tested in isolation instead of using something like Selenium or HttpUnit on the assembled application?
Backing beans can be easily isolated (if written to be testable) but I am interested in testing the template/display parts of the application while using as little o...
Hi!
Should I still bother with releasing objects in a unit test?
I noticed in Apple's "iPhoneUnitTests" sample project objects are [[object alloc] init] in the setup method but never released anywhere in the unit test?
Thanks!
...
Hey People. I have been recently validating Struts 2 actions.
In One of my action class, the save method to be precise must have two id's.
That is an assessmenttype id and a course id.
this is what is have so far.
@Test
public void testSave() {
Assessment assessment = new Assessment();
assessment.setAssessmentType(assessment.get...