unit-testing

Testing Solr via Embedded Server

Hallo everybody, i'm coding some tests for my solr-indexer application. Following testing best practices, i want to write codes self-dependant, just loading the schema.xml-solrconfig.xml config i want and creating a temporal data tree for the indexing-searching tests. As the application is most written in java, i'm dealing with SolrJ lib...

Is there a Unit Testing Framework for Starbasic?

Okay I know this is a really lame question because Starbasic is a really lame language, but...does anyone know of a unit testing framework for Starbasic? Sometimes we don't have the luxury of doing things in a sensible language like .net, because sometimes 80% the project is already written... :-D ...

How do I unit test code that creates a new Process?

How can I test the following method? It is a method on a concrete class implementation of an interface. I have wrapped the Process class with an interface that only exposes the methods and properties I need. The ProcessWrapper class is the concrete implementation of this interface. public void Initiate(IEnumerable<Cow> cows) {...

Unit testing the MS AJAX Toolkit HTML editor

Is it possible to unit test the MS AJAX Control Toolkit's HTML Editor? I've tried Watin, WebAii and Selenium without any success... Watin I can find the textbox related to the control but I get an exception trying to access it: using (Browser ie = new IE()) { ie.GoTo(testUri); Assert.IsTrue(ie.ContainsText("Expected text")); ...

How do I get the Rails test database to rebuild before each test?

I'm currently in the process of beginning a migration from fixtures to factories and running into some test database challenges. When I run my entire test suite the database is cleaned out and the new factory-generated data reloaded. However, when I run individual unit tests the database does not clean out the old values. I could run ...

HttpSimulator and Null Reference from ResolveAdapter()

I'm trying to unit test a few controls using the HttpSimulator object from subtext (more here). However, some controls throw a NullReferenceException from the method System.Web.UI.Control.ResolveAdapter(). Has anyone dealt with this problem? Is there a different tool that allows simulating the session and request structure but doesn't h...

How to do TDD and unit testing in powershell?

With MS ramming powershell into all new server products, I'm starting to (reluctantly) think I need to take it seriously. Part of "taking it seriously" is TDD. Have you found good methods to unit test power shell scripts? I've found samples of mocking from Mr Geek Noise - but I'd really like something like RhinoMocks. Brian Hartsock ha...

QUnit with Ajax! QUnit passes the failing tests!

I am looking into QUnit for JavaScript unit testing. I am in a strange situation where I am checking against the value returned from the Ajax call. For the following test I am purposely trying to fail it. // test to check if the persons are returned! test("getPersons", function() { getPersons( func...

I created NUnit tests, now how do I run them?

I'm developing in vs2008, c#, .net 3.5. I downloaded NUnit 2.5 win / msi version. I have created a [TestFixture] Class containing several [Test] methods. How do I run the tests? When I run a NUnit demo solution from Ed Ames, his test .cs files have an icon in the grey column to the left of the code (same place where breakpoints, bo...

Where are the Unit Test templates in the VS Unit Testing Framework?

I am increasingly annoyed by the unnecessarily verbose template that is used when I create a new unit test in Visual Studio (using the default, included unit testing framework). Instead of public ImportModelStateTest() { // // TODO: Add constructor logic here // } private TestContext testContextInstance; /// <summary> ///Gets or se...

Performance testing strategy web app

We recently had a web app that went out to site acceptance testing where they found severe performance problems related to request size (massive viewstate ASP.net). We need to ammend our testing strategy to include performance testing, can anyone give us guidance on best practices please? ...

How to apply "One Assertion Per Test" for OR relation condition

It's recognized that "One Assertion Per Test" in assertion. It is not good to write assertion like below: Assert((foo != null) && (bar != null)); The better chocie is: Assert(foo != null); Assert(bar != null); The question is what if the assertion is: Assert((foo == null) || (foo.length == 0)); The relationship is OR ins...

Comparing entities while unit testing with Hibernate

I am running JUnit tests using in memory HSQLDB. Let's say I have a method that inserts some values to the DB and I am checking if the method inserted the values correctly. Note that order of the insertion is not important. @Test public void should_insert_correctly() { MyEntity[] expectedEntities = new MyEntity[2]; // init expec...

Problem with Unit test and SQL database Connection

I am having a problem with a unit test I have created. First time doing this so I am not sure why I am getting this error <DeploymentItem("ETDS.exe")> <DataSource("System.Data.SqlClient", "Data Source=Foo;Initial Catalog=FooDB;Integrated Security=True", "User_Names", DataAccessMethod.Sequential)> <TestMethod()> _ Public Sub ValidateUser...

How Do I Use the MoqAutoMocker that comes with StructureMap 2.5.3?

I'm trying to use the MoqAutoMocker class that comes with StructureMap and I can't find any examples of how it should be used. All I have to go on is the example at the StructureMap site that uses RhinoMocks. What I'm trying to do is get reference to one of my auto-mocked/injected dependencies using the Get method. According to that l...

Does YAGNI also apply when writing tests?

When I write code I only write the functions I need as I need them. Does this approach also apply to writing tests? Should I write a test in advance for every use-case I can think of just to play it safe or should I only write tests for a use-case as I come upon it? ...

Getting started with tests in Rails

We have chosen to use rails to build a small project of ours. This is a really small project and will likely take six man-months or less. All people working on the project are new to Rails and have limited amount of experience in web coding. Our software is supposed to give users an easy-to-use interface to browse vast quantities of mea...

Are there any free hosters of continuous integration servers?

I have just started up a simple open source project and hosted it on google but I would love it if there was a free CI server I could create a job on to monitor my source. I've had a little search around and couldn't find anything. Ideally, I'd like a Hudson server somewhere that is free for me to use that I can create a Job on to moni...

Version control and test-driven development

The standard process for test-driven development seems to be to add a test, see it fail, write production code, see the test pass, refactor, and check it all into source control. Is there anything that allows you to check out revision x of the test code, and revision x-1 of the production code, and see that the tests you've written in ...

Cannot create unit test for module - Does this symbolize bad design?

I have an application that returns data dependent on the time specified, I can specify days, months or years. The issue is that if I were to run the application today and ask it to return data from 1 month ago and in 3 months time I were to ask the application to return data from that date for the previous 1 month (i.e. 1 month from date...