unit-testing

what's a good technique for building and running many similar unit tests?

I have a test setup where I have many very similar unit tests that I need to run. For example, there are about 40 stored procedures that need to be checked for existence in the target environment. However I'd like all the tests to be grouped by their business unit. So there'd be 40 instances of a very similar TestMethod in 40 separate cl...

How do you run your unit tests? Compiler flags? Static libraries?

I'm just getting started with TDD and am curious as to what approaches others take to run their tests. For reference, I am using the google testing framework, but I believe the question is applicable to most other testing frameworks and to languages other than C/C++. My general approach so far has been to do one of three things: Write...

test secure login and signup over SSL

I have implemented secured login and signup in my website.It working.Now I want to test it.I am not sure how to test whether it is correctly secured. ...

VisualAssert Testing in C++, Loading a test fixture.

Good day, I am learning Testing in Visual Studio C++ and I have several tutorials which I have followed. I am trying to load a test fixture. I have tried to put the test .cpp file in many different places but it will still not pick up on it when I click on "Run Tests" or "Run Tests without debugging" In the tutorials I found, they seeme...

VC++ and VisualAssert

Hi, For some reason I can't get my test's to load in my project. In the test explorer it says "This process exited without registering with the agent - this may be due to the module not containing any test fixtures" ....I've tried Right Click->Add TestFixture, and adding them other various ways I can get it to work on a blank projec...

Attribute to skip over statement in unit test c#

I am looking to skip a certain statement in my unit tests eg: if (MessageBox.Show("Are you sure you want to remove " + contact.CompanyName + " from the contacts?", "Confirm Delete", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) == MessageBoxResult.Yes) is there an attribute i can place above the statement to ...

program to Unit Test in Visual Studio 2008 VC++ (.exe file)

What program is best to unit test a exe targeted project in Visual Studio 2008, VC++? ...

MSTest Deployment without DeploymentItemAttribute

Is there any way to deploy an item without using this attribute? I'm starting to get a stack of attributes over my test base and it's becoming hard to maintain. Most of my items are DLLs that need to be put into a folder below the deployment directory. ...

PHP unit tests for controller returns no errors and no success message.

I'm using the zend modular director structure, i.e. application modules users controllers . . lessons reports blog I have a unit test for a controller in 'blog' that goes something like the below section of code: I'm definitely doing somet...

Unit Testing in QTestLib - running single test / tests in class / all tests

I'm just starting to use QTestLib. I have gone through the manual and tutorial. Although I understand how to create tests, I'm just not getting how to make those tests convenient to run. My unit test background is NUnit and MSTest. In those environments, it was trivial (using a GUI, at least) to alternate between running a single test, o...

How to rollback in EF4 for Unit Test TearDown?

In my research about rolling back transactions in EF4, it seems everybody refers to this blog post or offers a similar explanation. In my scenario, I'm wanting to do this in a unit testing scenario where I want to rollback practically everything I do within my unit testing context to keep from updating the data in the database (yeah, we'...

Should methods containing LINQ expressions be tested / mocked?

Assuming I have a class with a method that takes a System.Linq.Expressions.Expression as a parameter, how much value is there in unit testing it? public void IList<T> Find(Expression expression) { return someCollection.Where(expression).ToList(); } Unit testing or mocking these sorts of methods has been a mind-frying experience fo...

Junit and EasyMock understanding clarifications

Still Now I am using JUnit, I came across EasyMock, I am understanding both are for the same purpose. Is my understanding correct? What are the advantages does EasyMock has over the Junit? Which one is easier to configure? Does EasyMock has any limitations? Please help me to learn ...

What is the way to go to fake my database layer in a unit test?

Hi, I have a question about unit testing. Say I have a controller with one create method which puts a new customer in the database: //code a bit shortened public actionresult Create(Formcollection formcollection){ client c = nwe client(); c.Name = formcollection["name"]; ClientService.Save(c); { Clientservice would call ...

Unit testing JSON output module, best practices

I am currently working on a module that takes one of our business objects and returns a json representation of that object to the caller. Due to limitations in our environment I am unable to use any existing json writer, so I have written my own, which is then used by the business object writer to serialize my objects. The json writer is...

how can i get the Model from an ViewResult in a asp.net mvc unittest?

Hi, i call a controller action in a unit test. ViewResult result = c.Index(null,null) as ViewResult; I cast the result to a ViewResult, because that is what i'm returning in the controller: return View(model); But how can i access this model variable in my unit test? ...

"rake test" doesn't load fixtures?

when i run rake test --trace here's what happens ** Invoke test (first_time) ** Execute test ** Invoke test:units (first_time) ** Invoke db:test:prepare (first_time) ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:abort_if_pending_migrations ** Execute db:...

How to create unit test for actualHeight in Silverlight 4?

How can I write a unit test to test the actualWidth property to a userControl in Silverligh 4? I hoped that this method would pass, but it fails. I am using the Silverlight ToolKit april 2010, and VS 2010. <TestMethod()> _ Public Sub TestAcrtualWidth() Me.MyUserControl.Width = 100 Me.MyUserControl.UpdateLayout() Assert.Is...

Run AIR Debug Launcher (ADL) without a GUI for continuous build

Is it possible to run the ADL without a GUI so that I can run FlexUnit tests during a nightly build? Right now, when I execute our test runner on our server (Ubuntu 9.04) it fails with the output: "Gtk-WARNING **: cannot open display:". Many thanks for any suggestions! ...

Testing Finite State Machines

I have inherited a large and firaly complex state machine at work. It has 31 possbile states to be in. It has the following inputs: Enum: Current State (so 0 -> 30) Enum: source (currently only 2 entries) Boolean: Request Boolean: type Enum: Status (3 states) Enum: Handling (3 states) Boolean: Completed The 31 States are really nee...