tdd

How do I unit test django urls?

烈酒焚心 提交于 2019-12-03 01:50:55
问题 I have achieved 100% test coverage in my application everywhere except my urls.py . Do you have any recommendations for how I could write meaningful unit tests for my URLs? FWIW This question has arisen as I am experimenting with Test-Driven Development and want failing tests before I write code to fix them. 回答1: One way would be to reverse URL names and validate Example urlpatterns = [ url(r'^archive/(\d{4})/$', archive, name="archive"), url(r'^archive-summary/(\d{4})/$', archive, name=

How do you unit-test a TCP Server? Is it even worth it?

大兔子大兔子 提交于 2019-12-03 01:49:26
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? The first thing to do is to separate the behavior(s) from the TCP packets that are incoming. Abstract that into a dispatch table or other such thing. Then write unit tests for each of the behaviors independent of how they were invoked. You can test the final TCP -> behavior layer with a test tool you write or borrow. That layer should be almost trivial if the code is factored properly.

Resources for TDD aimed at Python Web Development [closed]

喜你入骨 提交于 2019-12-03 01:32:51
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I am a hacker not and not a full-time programmer but am looking to start my own full application development experiment. I apologize if I am missing something easy here. I am looking for recommendations for books, articles, sites, etc for learning more about test driven development specifically compatible with

QUnit vs Jasmine? [closed]

你离开我真会死。 提交于 2019-12-03 01:17:39
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . What are the main differences between these two testing frameworks? I am a totally new to Test Driven Development and starting from the very beginning. 回答1: QUnit is very easy to get started with, as you only need to include two files and a little bit of markup, then you can

How do I add gem 'minitest' to my test helper?

天涯浪子 提交于 2019-12-03 01:14:12
I am new to Ruby on Rails and testing. When I run rake test I get the following error: /Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rack-1.3.4/lib/rack/backports /uri/common_192.rb:53: warning: already initialized constant WFKV_ /Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/turn-0.8.3/lib/turn/autorun /minitest.rb:14:in `<top (required)>': MiniTest v1.6.0 is out of date. (RuntimeError) `gem install minitest` and add `gem 'minitest' to you test helper. from /Users/jarvis/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.1.1/lib /active_support

Asserting that a method is called exactly one time

☆樱花仙子☆ 提交于 2019-12-03 01:11:28
I want to assert that a method is called exactly one time. I'm using RhinoMocks 3.5. Here's what I thought would work: [Test] public void just_once() { var key = "id_of_something"; var source = MockRepository.GenerateStub<ISomeDataSource>(); source.Expect(x => x.GetSomethingThatTakesALotOfResources(key)) .Return(new Something()) .Repeat.Once(); var client = new Client(soure); // the first call I expect the client to use the source client.GetMeMyThing(key); // the second call the result should be cached // and source is not used client.GetMeMyThing(key); } I want this test to fail if the second

What is the difference between a Seam and a Mock?

两盒软妹~` 提交于 2019-12-03 01:05:37
Its being a few months since I am working with java legacy code, this are some of the things I am dealing with: 0% test coverage. Huge functions in occasions I even saw some with more than 300 lines of code. Lots of private methods and in occasions static methods. Highly tight coupled code. At the beginning I was very confused, I found difficult to use TDD in the legacy. After doing katas for weeks and practicing my unit testing and mocking skills, my fear has decreased and I feel a bit more confident. Recently I discovered a book called: working effectivelly with legacy , I didn't read it, I

Unit Tests vs. Acceptance Tests

风流意气都作罢 提交于 2019-12-03 00:46:58
问题 Are you for one or the other? Or both? My understanding is unit tests: validate the system from the developer's point of view help developers practice TDD keep code modular assist in detecting errors at low levels of granularity Acceptance tests: validate the system from the business and QC / QA points of view tend to be high level as they're often written by people not familiar with the inner workings of the code I feel both are necessary. However, for minimization of redundant work, is it a

Team Foundation Build or TeamCity?

谁都会走 提交于 2019-12-03 00:29:30
问题 We are a mostly MS shop at work doing .NET LOB development. We also use MS Dynamics for our CRM app... all the devs are currently using VS/SQL Server 2008. We also use VSS, but everyone hates it at work and that is quickly on its way out. We are begining our initiative for TDD implementation across the team (~dozen ppl). I've gotten TeamCity setup and have my first automated builds running succesfully using the 2008 sln builder and also using SVN that a co-worker had setup who is doing the

Android Test Driven Development

梦想与她 提交于 2019-12-03 00:20:30
问题 I have considerable experience in making Android applications. For my new project, we have decided to do Test Driven Development (TDD). I have been getting my hands wet on Robotium for User Scenario Testing, and it works fine and looks easy too. For unit testing, I tried to mock Context using (MockContext Android Class) but I am unable to do so. I went through this blog http://sites.google.com/site/androiddevtesting/ and through this http://sdudzin.blogspot.com/2011/01/easy-unit-testing-for