unit-testing

Testing Popups using NUnit

I'm using VS2005 and NUnit. I would like to know if there is a way to test popups using just NUnit. button1.click(); <-Find/Assert if the popup window has been opened-> ...

How to automate tests for reports in SSRS

My current project uses SSRS as the reporting engine. I have the report executing a text command with about 10 variables passed to it. I have been looking for a solution on how to unit test (acceptance or integration, whatever, just some automation) to an SSRS report project. I thought about using this method: Move the SQL text comm...

How does one unit test the addition of a row to a database with Zend Framework & PHPUnit?

To test inserting/update of a row, I've written a test to simulate a post, to check that it redirects, and to check that the newly inserted/updated text is on the page. The code works, but not the test - can you tell me why it's wrong? public function testEditProduct() { $request = $this->getRequest(); $request->setMethod('POST...

Test Anything Protocol in Shell scripts

Has anyone seen, tried to implement, or otherwise played with TAP in shell? We're looking to create unit tests across many languages (don't get me started on why this doesn't exist so far), and since we have so much Perl code, we'll be looking at TAP (among others, I imagine). I've found a TAP library for C, Perl, of course, has it bui...

testing with selenium

I'm a complete selenium newbie. Where should I start if I want to learn how to use it? ...

Testing a WPF Window with StaticResources

Hi, I have a simple Window with a reference to a StaticResource in the App.xaml App.xaml resource definition <!-- Standard Text Box Style --> <Style x:Key="textBoxStyleStd" TargetType="{x:Type TextBox}"> <Setter Property="FontSize" Value="14" /> </Style> Window componets using the resource <TextBlock Grid.Co...

ReSharper Unit Test Runner: Support for Deployment Items

I like the Unit test runner in ReSharper 4.5, and would like to use it with my MSTest tests, but one thing annoys me: In some of our solutions, we have set up some Deployment Items in the .testrunconfig file. The ReSharper Unit Test runner does not seem to respect this, so I get errors when trying to run the unit tests from ReSharper. ...

What is the best way to do unit testing for software that behaves differently for different users?

As noted by the question's title, what is the best way to preform unit testing on an application that behaves differently depending upon what user is currently logged in? Also, for applications that maintain information on the internal state, what is the best way to preform the testing and to manage all of the tests? ...

How do you introduce unit testing into a large, legacy (C/C++) codebase?

We have a large, multi-platform application written in C. (with a small but growing amount of C++) It has evolved over the years with many features you would expect in a large C/C++ application: #ifdef hell Large files that make it hard to isolate testable code Functions that are too complex to be easily testable Since this code is t...

PHPUnit for command line integration tests

Recently, I've started to working on Email2SMS feature in our product. When I joined the project this component had zero code coverage by unit-tests. Legacy code. Since I started to working on it, I was using test-first approach. But code quality was very low. It was very hard to split it and tests small chunks by unit-tests, so I decid...

Thoughtworks Cruise: Unit Testing?

I'm evaluating Cruise (NOTE! Not CruiseControl but Cruise (commercial)) for doing CI with an unmanaged MSVC++ 2008 project. I use GoogleTest framework for my unit test. I know that GTest can output its result as an JUnit XML or XML format. My question is, does Cruise support JUnit/XML format? How would Cruise know whether or not my unit...

How do you organise your MVC controller tests?

I'm looking for tidy suggestions on how people organise their controller tests. For example, take the "add" functionality of my "Address" controller, [AcceptVerbs(HttpVerbs.Get)] public ActionResult Add() { var editAddress = new DTOEditAddress(); editAddress.Address = new Address(); editAddress.Countries = countryService.Ge...

C#/.NET: Testing BackgroundWorker with NUnit

This test fails when it is run with the NUnit console runner. It works if I run just that test with TestDriven.NET, but not if I run the entire suite with TestDriven.NET: [Test] public void BackgroundWorkerFiresRunWorkerCompleted() { var runner = new BackgroundWorker(); ManualResetEvent done = new ManualResetEvent(false); runner.R...

JUnit test cases- setting up data

I have a simple CRUD operations that needs to be unit tested These test cases are for DAO layer- so all tests are against the database and hence cant be mocked. So I have one test cases for create another for update and another for read. 1) Should I hard code the data in the JUnit class or do you externalize it ? 2) The Read TestCase ...

Best way to test SQL queries.

So i have run into a problem in that we keep having complex SQL queries go out with errors. essentially this results in sending mail to the incorrect customers and other 'problems' like that. What is everyone's experience with creating SQL queries like that, essentially we are creating new cohorts of data every other week. so here ar...

Making unit tests fail quickly for mutation testing

One problem encountered with mutation testing is that it's slow, because by default you do a full test run (either a test file, or a suite of test files) for each mutation generated. One way to make mutation testing faster would be to stop the test run for a given mutant once a single failure has been encountered (but only during mutati...

Automated GUI testing of legacy non-MFC application?

We have a system that was originally developed decades ago and has increased in code base over the years. This is a fairly major system, with configuration that our department maintains (the vendor does not allow us access to the source or underlying database). The client software is a proprietry developed application which is basically ...

What are the drawbacks to compiling C++ projects with /clr:safe to enable unit testing?

I would like to introduce unit testing to our C++ product and wanted to investigate the pros and cons of trying to use the CLR-based unit tests. I've read that if you compile with the /clr:safe option, you can call your existing C++ code. I'm strictly a .NET developer, so I'm at a loss for how this would affect our codebase. What shou...

Unit testing Zend controllers - how do I test what has been set in the view

In Zend, models are added to the view: //In a controller public function indexAction() { //Do some work and get a model $this->view->model = $model; } We can easily check that "model" exists in the view (I'm using simpletest for this): //In a unit test public function testModelIsSetInView() { //Call the controllers inde...

Matching a pair of comments in HTML using regular expressions

I have a mako template that looks something like this: % if staff: <!-- begin staff --> ... <!-- end staff --> % endif That way if I pass the staff variable as being True, those comments should appear. I'm trying to test this by using a regular expression that looks like this: re.search('<!-- begin staff -->.*<!-- end st...