tdd

How to set execution order of mocha test cases in multiple files

可紊 提交于 2019-11-27 05:31:50
问题 I have two javascript files which contain mocha test cases. //----------abc.js ------------- describe("abc file", function(){ it("test 1" , function(){ assert.equal(20 , 20); }); }); //---------xyz.js-------------- describe("xyz file", function(){ it("test 1" , function(){ assert.equal(10 , 10); }); }); I have put them in a folder called test and when I execute the mocha command the first file(abc.js) is always executed before xyz.js. I thought this might be due to alphabetical ordering and

Moving existing code to Test Driven Development

流过昼夜 提交于 2019-11-27 05:07:28
问题 Having recently discovered this method of development, I'm finding it a rather nice methodology. So, for my first project, I have a small DLL's worth of code (in C#.NET, for what it's worth), and I want to make a set of tests for this code, but I am a bit lost as to how and where to start. I'm using NUnit, and VS 2008, any tips on what sort of classes to start with, what to write tests for, and any tips on generally how to go about moving code across to test based development would be greatly

Testing browser extensions

前提是你 提交于 2019-11-27 05:00:16
问题 I'm going to write bunch of browser extensions (the same functionality for each popular browser). I hope, that some of the code will be shared, but I'm not sure about this yet. For sure some of extensions will use native API. I have not much experience with TDD/BDD, and I thought it's good time to start folowing these ideas from this project. The problem is, I have no idea how to handle it. Should I write different tests for each browser? How far should I go with these tests? These extensions

How to verify that a specific method was not called using Mockito?

人走茶凉 提交于 2019-11-27 04:59:21
问题 How to verify that a method is not called on an object's dependency? For example: public interface Dependency { void someMethod(); } public class Foo { public bar(final Dependency d) { ... } } With the Foo test: public class FooTest { @Test public void dependencyIsNotCalled() { final Foo foo = new Foo(...); final Dependency dependency = mock(Dependency.class); foo.bar(dependency); **// verify here that someMethod was not called??** } } 回答1: Even more meaningful : import static org.mockito

Unit Testing without Database: Linq to SQL

随声附和 提交于 2019-11-27 04:49:00
问题 I have a repository implemented using LINQ to SQL. I need to do Unit Testing though I don't have a database. How can I write the UT for FreezeAllAccountsForUser method? Can you please show an example using manually mocking? Note: There is inheritance mapping used in domain objects Note: Unit Testing is to be done using Visual Studio Team Test Comment from @StuperUser. Unit testing involves completely isolating code from the other objects it interacts with. This means that if the code fails,

Are there any good TDD tools or resources for VB6?

爷,独闯天下 提交于 2019-11-27 03:59:46
问题 Yea i know i'm way behind times but what i've got here is a antique VB6 editor app which i believe that no one will be upgrading to .NET soon. It uses a couple of third party DLLs tools and as it's still using the good old RichEdit control i basically can raise my own Bug farm with just this tool alone. So enough is enough and i'm trying to see if i can use TDD so i can start writing unit test for each behavior/feature that i need to fix, so sooner or later i can have a complete regression

Rails Rspec error - undefined method `visit'

眉间皱痕 提交于 2019-11-27 03:25:53
问题 So I'm new to TDD & I'm throwing some Rspec errors here on my tests...Basically after running bundle exec rspec spec, I get an undefined method 'visit' error on some of my specs. Any help on how to make these tests pass would be much appreciated: Thanks. Failures: 1) User pages profile page Failure/Error: before { visit user_path(user) } NoMethodError: undefined method `visit' for # <RSpec::Core::ExampleGroup::Nested_2::Nested_1:0x007ffda8049540> # ./spec/requests/user_pages_spec.rb:9:in

Is it bad practice to run tests on a database instead of on fake repositories?

泄露秘密 提交于 2019-11-27 03:17:31
问题 I know what the advantages are and I use fake data when I am working with more complex systems. What if I am developing something simple and I can easily set up my environment in a real database and the data being accessed is so small that the access time is not a factor, and I am only running a few tests. Is it still important to create fake data or can I forget the extra coding and skip right to the real thing? When I said real database I do not mean a production database, I mean a test

What test methods do you use for developing websites?

余生长醉 提交于 2019-11-27 02:24:22
问题 There are a lot of testing methods out there i.e. blackbox, graybox, unit, functional, regression etc. Obviously, a project cannot take on all testing methods. So I asked this question to gain an idea of what test methods to use and why should I use them. You can answer in the following format: Test Method - what you use it on e.g. Unit Testing - I use it for ...(blah, blah) Regression Testing - I use it for ...(blah, blah) I was asked to engage into TDD and of course I had to research

What is the best practice when it comes to testing “infinite loops”?

元气小坏坏 提交于 2019-11-27 02:11:16
问题 My basic logic is to have an infinite loop running somewhere and test it as best as possible. The reason for having an infinite loop is not important (main loop for games, daemon-like logic...) and I'm more asking about best practices regarding a situation like that. Let's take this code for example: module Blah extend self def run some_initializer_method loop do some_other_method yet_another_method end end end I want to test the method Blah.run using Rspec (also I use RR, but plain rspec