(No "related questions" seem to nail this, so here goes.)
I work on production code. Arguing for anything that isn't visible to the user is hard to do, sometimes. If sales can't see it, it's an external cost to them, and they'll argue against it unless there's a great reason not to.
How much unit testing is a good thing? If you test...
The following is the app/models/websites.rb
class Masterpiece < ActiveRecord::Base
validates_presence_of :title, :link
validates_uri_existence_of :link, :allow_redirect => false
end
The second validation is from the plugin Validates Existence of URI plugin
The following is the features/support/mocha.rb file
require 'mocha'
W...
On linux I am using a command such as:
configure_file(dot_alpha_16.bmp test/dot_samples/dot_alpha_16.bmp COPYONLY)
to copy some unit test files to the build directory. On windows the files aren't getting copied. Is there a specific reason why this happens?
...
After having accumulated enough tests that running them all takes some real time, I looked at the Test::Class::Load doc to find a tip for running individual test classes. It provides a manner to do this, but I must be missing something, because I can't make it work. Here's what I have:
My test directory:
drewfus:~/sandbox$ ls t/
lib/...
My guess is that the current semantics of unit testing involve actually calling the method, i.e., if I have a method MyTest() then that's what gets called. My question is this: is it possible to somehow change the pipeline of the way tests are executed (preferably without recompiling the test runner) so that, say, instead of calling the ...
What is the syntax to use the [TestDescriptionAttribute][1] of a test to populate the Description column in the Test Results window?
Context: Visual Studio 2008 Team System
I've read the documentation, but am not able to find a concrete example.
Based, loosely, on Ngu's suggestion, I've tried:
using GlobalSim;
using Microsoft.Visual...
Hello folks,
I am building a logic test suite using Xcode 3.1.4. I am able so far to build the test target and see the results inside de *.m test files as compiler errors (if they fail). The problem is that I can't see any information in the Debugger Console and I can't debug since the debugger does not work either.
1.How can I do to...
I have a bunch of unit tests that work on a class which executes some tasks asynchronously. Currently I set up the class, then execute the function in question. I then go into a blocking wait until the execution is completed, then test the data I need to. Is there a better way that I can do this?
So far my tests look similar to this:
...
Hi
I have a base controller that I made so I can pass data to the master page view easily. However this base controller gets a service layer passed into it and everything time I run my unit tests this service layer kills it since it tries to access some database stuff.
private ServiceLayer service;
public ApplicationControll...
Hi
I have my own custom Authorize Attribute and I am trying to check my controller methods to see if they have the correct roles in place. Now my custom authorize tag has database code in it.
The ways I am mocking it up don't seem to work since the reflection stuff I found seems to to just pass no arguments so my default constructor i...
Any Java unit testing framework that supports writing unit testing code like this:
Collection<AType> myCollection = objectUnderTest.doSomething();
assertCollectionContainsAtleast(myCollection, "a Expected value");
Meaning what I would like is some sort of iteration support with some sort of matcher attached.
...
Using NUnit 2.5 in VS 2008, i'm not sure how to test that a function simply return;s when some condition is set. Is there an Assert method that serves my purpose, or is this not testable?
...
What frameworks and tools would you recommend for unit-testing and mock objects in Perl?
I have an existing Perl application, that mainly does database access, reading and writing files. The application is basically a batch job type of application, it reads in bunch of stuff from files and database and writes a bunch of new files and so...
Am writing unit tests for an app that has matured a lot with time..We are using NDBUnit as the test cases become independent of each other..while we started the development of this app the DB schema was pretty manageable and hence dragging and dropping the tables on VS designer to create an XSD was never an issue. Well, with my current D...
I have the following code (which I've dumbed down for the question):
public void HandleModeInit(int appMode){
switch(appMode){
Case 1:
DoThis();
Case 2:
DoThat();
Case 3:
//no mode 3
Case 4:
DoSomethingElse();
...
I get the error in subj when I'm trying to run specs or generators in a fresh rails project.
This happens when I add shoulda to the mix.
I added the following in the config/environment.rb:
config.gem 'rspec', :version => '1.2.6', :lib => false
config.gem 'rspec-rails', :version => '1.2.6', :lib => false
config.gem "thoughtbot-shoulda"...
Hi,
I am struggling a bit to understand how the new AAA syntax works in Rhino Mocks. Most of my tests look like this:
[Test]
public void Test()
{
//Setup
ISth sth= mocks.DynamicMock<ISth>();
//Expectations
Expect.Call(sth.A()).Return("sth");
mocks.ReplayAll();
//Execution
...
I have difficulty in many situations to come up with a good unit test names for classes and methods. Typically, I try to follow the form:
public class TestContext
{
[Fact]
public void WhenThis_DoThat()
{
}
}
Some put words Given, When, and Then on the parts to be explicit. I like it because it seems to make the unit ...
I want to test the data inside the "item" object before it redirect to another action.
public ActionResult WebPageEdit(WebPage item, FormCollection form)
{
if (ModelState.IsValid)
{
item.Description = Utils.CrossSiteScriptingAttackCheck(item.Description);
item.Content = Utils.CrossSiteS...
I just watched this funny YouTube Video about unit testing (it's Hitler with fake subtitles chewing out his team for not doing good unit tests--skip it if you're humor impaired) where stubs get roundly criticized. But I don't understand what wrong with stubs.
I haven't started using a mocking framework and I haven't started feeling the...