How do I refactor to remove the code duplication in this spec:
describe 'TestPlugins'
describe '.MovieScanner(document)'
before_each
MoviePage_loggedIn = fixture("movie_logged_in.html") // Get logged-in movie page
MoviePage_notloggedIn = fixture("movie_not_logged_in.html") // Get no...
All great stories they always start with those 4 magical words... I have inherited a system... no wait! that isn't right!
Anyway with my attempt at humour now passed I have not so much been given more I have to support an existing service.
There are many many issues when it comes to using this service, as an example one is to create a ...
I am trying to grasp the entire TDD methodology and as such, I don’t really know how to present this as a nice concise question so here is the long drawn out version.
I seem to be experiencing a gap between the bowling (Martin), money (Feathers), and other similar game/simple examples and a fully functioning Enterprise app.
I am trying ...
Possible Duplicate:
Mocking vs. faking, when to use what?
When to use Mock and when to use fake?
...
I am aware of this question: http://stackoverflow.com/questions/428691/how-to-encourage-implementation-of-tdd
In my team, we write a lot of unit tests. But, in general the programmers tend to write unit tests after wrting the code. So, we first finish the module functionality and then write tests. Our coverage is around 70% for most mod...
I am trying to use Rhino.Mocks to mock up a ControllerContext object to gain access to runtime objects like User, Request, Response, and Session in my controller unit tests. I've written the below method in an attempt to mock up a controller.
private TestController CreateTestControllerAs(string userName)
{
var mock = MockRepository....
Consider this code:
public void actionPerformed(ActionEvent e) {
setEnabled(false);
new SwingWorker<File, Void>() {
private String location = url.getText();
@Override
protected File doInBackground() throws Exception {
File file = new File("out.txt");
Writer writer = null;
...
I am attempting to test the Index action of a controller. The action uses AutoMapper to map a domain Customer object to a view model TestCustomerForm. While this works I am concerned about the best way to test the results that I am receiving from the Index action.
The controller's index action looks like this:
public ActionResult Index...
My controllers are utilizing StructureMap and AutoMapper. Presently, there is nothing exceptional with my routes. For the basic CRUD controller actions what tests should I be writing to ensure good code coverage?
...
I googled and read some good answers/posts on IOC and do understand the overall concept. I have an existing framework (not very well designed) and TDD is an after thought to write some NUNIT test fixtures. Can I use IOC on an existing code base with out changing the existing code base? Or IOC is used when we are designing application fro...
In JUnit FAQ you can read that you shouldn't test methods that are too simple to break. While all examples seem logical (getters and setters, delegation etc.), I'm not sure I am able to grasp the "can't break on its own" concept in full. When would you say that the method "can't break on its own"? Anyone care to elaborate?
...
Let me preface this be saying that I'm newb to both TDD and Ruby on Rails.
I'm using Rspec to perform unit testing of my data layer and to ensure that my database is rejecting invalid input.
My rspec code looks as follows:
it "should fail at saving without name" do
@my_data.attributes = valid_my_data_attributes.except(:name)
@my_d...
I am starting to buy into BDD. Basically, as I understand it, you write scenario that describes well acceptance criteria for certain story. You start by simple tests, from the outside-in, using mocks in place of classes you do not implement as yet. As you progress, you should replace mocks with real classes. From Introduction to BDD:
...
I have been reading Effective Java and I have some concerns regarding the first Item "use
static factory method instead of constructor" in relation to TDD and dependency injection.
The item says that you should avoid having public/protected/default constructor and expose
it using static factory. I agree with all the advantages relate...
I am using MS Test with Visual Studio 2010 to write unit Tests. When I debug a Test it shows a Message box as shown below
Title : Downloading public symbols
Message : System.XXXX.dll
Has anyone else faced this issue with MS Test on Visual Studio 2010?
This problem does not come when I run a test. Its only when I try to Debug a Test
...
For example, there is a interface IMyInterface, and three classes support this interface:
class A : IMyInterface
{
}
class B : IMyInterface
{
}
class C : IMyInterface
{
}
In the simplest way, I could write three test class : ATest, BTest, CTest and test them separately. However, since they support the same interface, most test code ...
I always learned that doing maximum code coverage whit unit tests is good. I also hear developers from big companies such as Microsoft saying that they write more lines of testing code than the executable code itself.
Now, is it really great? Doesn't it seem sometimes like a complete loss of time which has an only effect to making maint...
I'm about to start looking into developing with the aid of code coverage, and I'm wondering how it typically fits in with test driven development.
Is code coverage an afterthought? Does your process go something like
Write a test for the functionality to be implemented
Run test, make sure they fail
Implement functionality
Run test, ma...
Hi, I'm learning TDD with VB.NET and NUnit. I want to know what's the best thing to do: Use a lot of Assert methods inside of a test method or use a assert per method?
This is my code. Thank you.
Imports NUnit.Framework
<TestFixture()> _
Public Class CalculatorTest
<Test()> _
Public Sub TestAdd()
Dim calculator As Calculator = New...
I have a class A which contains an instance of class B, and function foo of A calls function set of B, which updates the state of B. Here is a code example (in Javascript):
A = function () {
this.init = function (b) {
this.b = b
}
this.foo = function (val) {
this.b.set(val)
}
this.bar = function () ...