For instance if I wanted to unit test the following controller what do I replace ???? with?
using System.Web.Mvc;
namespace MvcApplication1.Controllers
{
public class StatusController : Controller
{
public ActionResult Index()
{
return Content("Hello World!");
}
}
}
[TestMethod]
public v...
My web application depends on a web.config entry being a certain value (like FEATURE_ACTIVATED=true) so how do I test the function that reads this web.config entry?
I'd like to avoid copying the web.config entries to an app.config in the unit testing project, as it takes extra effort to synchronize the files.
...
I'm writing and testing a ClassLoader component, which can be instantiated many times, with various mappings between class names and their relevant paths. Each ClassLoader should work as a loader for a specific package.
Is there an easy, unobtrusive way to test or mock inclusion of files handled by the ClassLoader?
Let me clarify with ...
Anyone know of any good resources to get me started with test driven development on the Android platform?
...
I have a test which looks a bit like this (I'm simplifying a bit from my real issue):
[Test]
public void Eat_calls_consumption_tracker_OnConsume()
{
var consumptionTrackerStub =
MockRepository.GenerateStub<IConsumptionTracker>();
var monkey = new Monkey(consumptionTrackerStub);
var banana = new Banana();
monkey.Eat(b...
I'm having a problem unit testing a class which fires events when a thread starts and finishes. A cut down version of the offending source is as follows:
public class ThreadRunner
{
private bool keepRunning;
public event EventHandler Started;
public event EventHandler Finished;
public void StartThreadTest()
{
...
I asked a question about building custom Thread Safe Generic List now I am trying to unit test it and I absolutely have no idea how to do that. Since the lock happens inside the ThreadSafeList class I am not sure how to make the list to lock for a period of time while I am try to mimic the multiple add call. Thanks.
Can_add_one_item_at_...
Hello,
I am a fairly new software developer currently working adding unit tests to an existing C++ project that started years ago. Due to a non-technical reason, I'm not allowed to modify any existing code. The base class of all my modules has a bunch of methods for Setting/Getting data and communicating with other modules.
Since I ju...
hello ,
from eclipse under linux machine, I like to launch java test
I have in my code :
entry poiny.main(new String[]{"-rtebase", "/./././bin" "-Linux"});
it says, rtebase, linux are not well spelled
...
Hi,
I have a method i'd like to stub but it has a lot of parameters.
How can i avoid mocking all parameters but still stub the method.
Ex:
//Method to stub
public void myMethod(Bar bar, Foo foo, FooBar fooBar, BarFoo barFoo, .....endless list of parameters..);
...
How do I unit-test a Zend_Form form class I wrote for my application?
I aspire to have a 100% code coverage, so just testing each controller that uses it, doesn't seem enough, but I could be missing something in the UnitTest approach..
...
A friend suggested instead of having a backend class which verifies the user permission in every public function (results are cached and non static) i should have a more 'streamlined' site. When i dropped the backend i also drop the database code and merged them in the appropriate user permission (base user, logged_in_user, moderator).
...
I'm a senior engineer working in a team of four others on a home-grown
content management application that drives a large US pro sports web
site. We have embarked upon this project some two years ago and chose
Java as our platform, though my question is not Java-specific. Since
we started, there has been some churn in our ranks. Each one...
I am writing (attempting to write) unit tests for a WPF application.
The business objects that the UI binds to implement IDataErrorInfo, such that when I set ValidatesOnDataErrors=True in my View xaml, the error indexer (this[]) is called anytime the setter for the bound business object is called.
That part is great.
Now if I call th...
Hi,
it's fairly easy to set up Eclipse to run a django project's tests created with django-admin startprojects, we whould just point a Run command to ./manage.py, and supply the necessary arguments.
but what can I do if a project is built using buildout?
of course, bin/biuldout creates the handy bin/test-1.1 and bin/test-trunk files, ...
I've started to dig into the GLib documentation and discovered that it also offers a unit testing framework.
But how could you do unit tests in a procedural language? Or does it require to program OO in C?
...
I'd like to unit test (jUnit 4) the behavior of my pages when the browser's back button (or forward or refresh) is clicked.
Can I somehow simulate the browser's back/forward/refresh buttons in a unit test?
Is there a utility class that provides such functionality?
2nd Edit:
I understand that the Wicket test facilities don't simulate a...
So, I just moved to new project that is built on Ruby on Rails. I'm new to it and I'm still learning it. I can debug most of the application code, but it seems I can not debug unit test code and code that is tested.
When I run unit testing in debug mode, I can set a breakpoint in unit test class code, for example where fixtures are adde...
Is there a difference between using tearDown and setUp versus init and del when using the pyUnit testing framework? If so, what is it exactly and what is the preferred method of use?
Thanks.
...
Using pyUnit to do what is currently a very small and simple unit test I am getting the message:
'import site' failed; use -v for traceback
...
____________________________________________
Ran 3 tests in 0.094S
When I rerun the unit test with the -v parameter, it returns verbose information about each of the 3 tests and has no error o...