I'm developing a small TCP server, which will process some TCP packets and behave differently based on the request.
How can I write unit test for this? If it's really hard to write, is it even worth the effort?
...
I'd like to override a class method without inheriting the base class because it'd take a lot of time and modifications and, therefore, more and more tests. It's like this:
class TestClass{
public void initialMethod(){
...
}
}
And somewhere on the code, I'd like to do something like this:
public testMethod()
{
ret...
I'm working on a project which is in serious need of some performance tuning.
How do I write a test that fails if my optimizations do not in improve the speed of the program?
To elaborate a bit:
The problem is not discovering which parts to optimize. I can use various profiling and benchmarking tools for that.
The problem is using au...
Hi there,
I have a couple of ActionMethods that queries the Controller.User for its role like this
Boolean isAdmin = User.IsInRole("admin");
acting conveniently on that condition.
I'm starting to make tests for these methods with code like this
[TestMethod]
public void HomeController_Index_Should_Return_Non_Null_ViewP...
It's well known that Bayesian classifiers are an effective way to filter spam. These can be fairly concise (our one is only a few hundred LoC) but all core code needs to be written up-front before you get any results at all.
However, the TDD approach mandates that only the minimum amount of code to pass a test can be written, so given t...
I'm currently tdding a "PluginsService" that I'm writing. I'm needing to use the System libraries of Assembly, AssemblyName, Directory and File. Currently I'm creating wrapper interfaces for each of these so I can mock them in the tests. This does mean however that I'm having to inject quite a few wrappers into the service.
So for ex...
Hi
I'm trying to test a method.
I want to ensrur that there is a method call in that method (calling service)
the code look like this:
using(proxy = new Proxy())
{
proxy.CallService();
}
I swap the proxy with fake object (using TypeMock)
but get error because of the fake object disposed in the end of block.
I don't want to ...
Edit: Language/Platform is C# / .Net
I'm currently trying to fill a vast unit-test void in my current project, and being admittedly new to TDD, find myself quite stumped as to how to go about testing some of the more business-critical features.
I picked up Moq and had an easy enough time doing simple mocks, however at the core of my ap...
I'm looking to write unit tests for a method such as this one:
public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer)
{
ISPMembershipUserDao userDao = GetISPMembershipUserDao();
if (ValidateUser(username, password))
{
SPMembershipU...
I have repository class that is used by at least 2 other classes. This repository class needs to be initialized - which is high in cost (querying database). Now, I create separate instances of repository wherever I need it. The thing is, that everytime I create repository it has to be initialized. How to design such repository to be TDD-...
I have just recently discovered how much I enjoy developing code the TDD way: I feel I have much more control over the direction the development is going. Whereas before I spent a lot of time designing data structures and algorithms up front, now I start small and "grow" my code organically. After every red/green/refactor cycle I have co...
I'm looking for a book that includes methods of testing software from a software engineering perspective.
Specifically, I'm looking for a book that includes black box testing techniques (such as how to test software against different input, etc.), but also includes information about test-driven development/design, unit testing, etc.
Wh...
Where can I find a good tutorial on TDD with ASP.NET MVC 1.0? I'd prefer a video tutorial but a text tutorial would be fine as well. I have a new project starting soon and I want to start off on the right foot.
...
I need to give a short presentation (2-4 hours) on Test-Driven Development and need to come up with a small class that I can build using the TDD methodology. The class has to be relatively small, but "sell" the concept of TDD.
If anyone has read James Newkirk's book, Test-Driven Development for in Microsoft.Net, the Stack example is pe...
I usually try to do TDD with not much analysis (no diagrams) before start coding. Usually I find myself spliting a class into other classes to separate concerns. I wonder if a deeper analysis would prevent that. I think that much of OO analysis can't predict some of those cases. What do you think?
...
Which is the first test I should write when following the TDD guidelines? A test for the whole system or for the smallest core method?
Example: A project should read a CSV and convert it to XML. My first test should be:
Take a CSV (input) and the corresponding XML (expected) and checking if the application does the conversion correctl...
Well I have been thinking about this for a while, ever since I was introduced to TDD.
Which would be the best way to build a "Hello World" application ? which would print "Hello World" on the console - using Test Driven Development.
What would my Tests look like ? and Around what classes ?
Request: No "wikipedia-like" links to what T...
What book would you recommend to learn test driven development? Preferrably language agnostic.
...
Duplicate:
Why should I practice Test Driven Development and how should I start?
Is it worth to start TDD?
For a developer that doesn't know about Test-Driven Development, what problem(s) will be solved by adopting TDD?
[EDIT] Let's assume that the developer already (ab)uses a unit testing framework.
...
I'm interested in learning python to have access to a more agile language for writing tests in my .NET projects.
Is IronPython mature enough for these purposes yet? I'm content with writing tests in C#, but find dynamic languages like ruby and python very attractive. Would it be better to forgo IronPython while learning, and stick to t...