testing

Testing a class with HttpContext.Current.Session in ASP.NET MVC

Hello. I'm adding some tests to a class that uses HttpContext.Current.Session internally and we are porting to ASP.NET MVC. My class looks like this: class Foo { public void foo() { HttpContext.Current.Session["foo"] = "foo"; } } I thought to change it like this: class Foo { IHttpSessionState session; pub...

Is there a good tool for documenting/monitoring System Tests?

Hi everyone, I'm looking for a tool to design, document, and monitor System Tests for a product. The basics of what I need are: 1) A tool that can represent some kind of Inheritance between tests (i.e., one test which sets up another or somesuch). 2) A tool that will allow me to monitor specific runs of the tests seperately, per versi...

Rhino Mocks - Stub .Expect vs .AssertWasCalled

Disclosure: I am a Rhino Mocks n00b! OK, I know there has been a lot of confusion over the new AAA syntax in Rhino Mocks, but I have to be honest, from what I have seen so far, I like. It reads better, and saves on some keystrokes. However, I am having problems getting my head around this, and seek some advice to make sure I am not mis...

How to test an application for correct encoding (e.g. UTF-8)

Encoding issues are among the one topic that have bitten me most often during development. Every platform insists on its own encoding, most likely some non-UTF-8 defaults are in the game. (I'm usually working on Linux, defaulting to UTF-8, my colleagues mostly work on german Windows, defaulting to ISO-8859-1 or some similar windows codep...

What are your experiences with AutomatedQA's TestComplete?

At my workplace we are thinking about buying TestComplete but after using the evaluation version, I'm not sure if it will do us any good. Creating tests seems to be a lot of work and my boss is not entirely convinced that it's worth it. On the other hand, we don't have any unit tests, so we desperatly need some automated testing. Wh...

How do you write tests to test functions with variable return values?

I've got a simple function like this: function CreateFileLink() { global $Username; return date("d-m-y-g-i"); } How do you write code to test a function like that where the return data is variable? ...

Database data needed in integration tests; created by API calls or using imported data?

This question is more or less programming language agnostic. However as I'm mostly into Java these days that's where I'll draw my examples from. I'm also thinking about the OOP case, so if you want to test a method you need an instance of that methods class. A core rule for unit tests is that they should be autonomous, and that can be a...

Automated testing of VBA UserForms- tools and/or techniques?

I am looking to start automated regression testing on a fairly large Excel add-in that revolves around a GUI composed of a few modal UserForms with standard controls. The main problem is that most of the automated testing tools I have looked into (Rational Robot, AutomatedQA TestComplete, Network Automation Automate etc) don't fully sup...

DAL code generator that can handle mocking and testing, .NET

Hi, I have been testing the nusoft kinetic framework and have been pretty satisfied with it until now. I was going to make some tests with MbUnit and Rhino Mock when I realized that the hole framework was built with static methods and protected classes, making this untestable. My question is, does any one know about a framework like the...

How can I think like a user?

We're neck deep in a project right now, schedules are tight (but reasonable). Our general strategy is to get a strong beta done, release it for testing, and get feedback from our testers. Quite frequently, we're being hit by small things that spiral into long, time-costing discussions. They all boil down to one thing: While we know wh...

How do I continuously run a single test case using Selenium?

I have recorded a very simple test case Using the Selenium IDE integrated with Firefox. I want the test case to run continuously over a period of time. How can I make the test run continuously? ...

JUnit produces strange AssertionFailedError

I am currently using JUnit 4.4 and Java 1.6.x. And after a recent code fix, we started getting this AssertionFailedError in my JUnit tests on the method: UtilityTest.testParseDate(4t): Mon Jan 15 09:26:07 PST 2001 expected: "Mon Jan 15 09:26:07 PST 2001" but was: "Mon Jan 15 09:26:07 PST 2001" junit.framework.AssertionFailedError: Util...

Watin in TFS?

I'm trying to get my WATIN tests to work in TFS2008 (continuous integration) as part of a nightly build. All tests work fine on my local machine (from VS2008), and my unit tests (non-watin) work great locally, as well as in TFS. to illustrate what we're doing I've got a simple test: [TestMethod] public void Watin() { ...

Using an ASP.NET repeater with an array?

This may be a silly question but I was writing a quick test page and realised that I didn't know how to bind an array or ArrayList of strings, for example, to an ASP.NET Repeater. I experimented a bit. <asp:Repeater ID="rptImages" runat="server"> <HeaderTemplate> <h3>Items</h3> </HeaderTemplate> ...

Testing checkbox click

I have started testing my UI using qUnit, so I need to simulate some user interaction. Is it possible to "simulate" a user clicking a checkbox using javascript ? ...

Howto pass Java system properties to maven-cargo container

I'm preparing a maven2 web project for continuous integration. I use the maven cargo plugin to automatically deploy the WAR to Tomcat6x before running integration tests. My code depends on some system properties which are set with MAVEN_OPTS=-Dfoo=bar. Unfortunately these properties are missing when the application is deployed to Tomcat...

ASP.Net MVC RC Unit Testing Ajax Requests

We have just started using ASP.Net MVC Release Candidate and the test project we have was previously testing Ajax requests with MVC beta. The old code looked something like this: Mock<HttpRequestBase> request = new Mock<HttpRequestBase>(); Mock<HttpResponseBase> response = new Mock<HttpResponseBase>(); Mock<HttpContextBase> context = n...

Context agnostic JavaScript Testing Framework

I'm looking for a JavaScript Testing Framework that I can easily use in whatever context, be it browser, console, XUL, etc. Is there such a framework, or a way to easily retrofit an existing framework so its context agnostic? Edit: The testing framework should not be tied to any other framework such as jQuery or Prototype.js and should...

How do I redirect stdout and stderr output from a Perl script to a file on WIndows?

I tried this: test1.pl >output.log 2>&1 but this is the result: Can't dup STDOUT: Permission denied at C:/Perl/lib/Test/Builder.pm line 1376. Compilation failed in require at C:/Perl/lib/Test/Builder/Module.pm line 3. BEGIN failed--compilation aborted at C:/Perl/lib/Test/Builder/Module.pm line 3. Compilation failed in require at C:/...

How to test for sometimes fails?

I'm trying to write a unit test for a module that will give me a random list of numbers given certain criteria. The particular test I'm writing is a reshuffle of the original sequence. I'm testing that The sequences are the same length The sequences have the same values The sequences are not in the same order The problem with this i...