tdd

How to set up separate test and development database in meteor

与世无争的帅哥 提交于 2019-12-09 11:03:07
问题 I've written a few tests for my meteor app. As they have setup and teardown methods that remove all documents or populate with new ones, I'd like to run them on a database dedicated to testing. I notice the db is stored in .meteor/local/db . Ideally I'd like to have db_test and db_dev accessed form different ports. Is this possible? 回答1: You'll have to run two mongod processes e.g. # Dev mongod --port 27017 --dbpath .meteor/local/db_dev # Testing mongod --port 28017 --dbpath .meteor/local/db

What is the difference between overload and alias in Mockery?

﹥>﹥吖頭↗ 提交于 2019-12-09 10:53:18
问题 I am new to using Mockery and confused with the terminology alias and overload . Can anyone please explain to me when to use which? 回答1: Overload is used to create an "instance mock". This will "intercept" when a new instance of a class is created and the mock will be used instead. For example if this code is to be tested: class ClassToTest { public function methodToTest() { $myClass = new MyClass(); $result = $myClass->someMethod(); return $result; } } You would create an instance mock using

Using Moq and TDD, where to start?

本秂侑毒 提交于 2019-12-09 09:56:58
问题 I have a server application and I was wondering where I should start if I want to start implementing TDD and using Moq. What good books I could read on the subject, which aren't too "web-oriented"? I have questions on the matter, like: Should I mock every object I want to test, or only those which I can't implement, like text writers? My server needs a lot of setup before it can actually do anything I want to test, should I just cram that into a [TestInitialize] function? How should I chain

TDD how to handle a change in a mocked object

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 08:14:15
问题 In writing unit tests, for each object that the unit interacts with, I am taking these steps (stolen from my understanding of JBrains' Integration Tests are a Scam): Write a test in the unit to ensure it is sending the correct call and params to the collaborating object Write a test in the unit that ensures it handles all possible responses from the collaborating object. These responses are all mocked so the unit is tested in isolation. Write a test in the collaborating object to make sure it

How to write User Stories for technical implementation details? [closed]

跟風遠走 提交于 2019-12-09 04:50:16
问题 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 2 years ago . I'm trying to work in a more organised way and started adopting user stories. I think I have misunderstanding of how should I use user stories for technical stuff. Let's say I'm coding an app that gives me the ranking of my site for a certain Keyword in Google. The user story

Is there any open source mocking framework resembling TypeMock? [closed]

ε祈祈猫儿з 提交于 2019-12-09 04:37:48
问题 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 last month . TypeMock is too expensive for a hobbist like me :) Moq or the next version of RhinoMocks have no plans on listening to the profiling API, why is that? EDIT: This enables features such as: Mocking non-virtual methods and properties (!). Mocking browser environments. simpler syntax which is less fragile (and not

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

岁酱吖の 提交于 2019-12-09 04:32:08
问题 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

Test Driven Development in PHP

岁酱吖の 提交于 2019-12-09 04:01:09
问题 I am a web-developer working in PHP. I have some limited experience with using Test Driven Development in C# desktop applications. In that case we used nUnit for the unit testing framework. I would like to start using TDD in new projects but I'm really not sure where to begin. What recommendations do you have for a PHP-based unit testing framework and what are some good resources for someone who is pretty new to the TDD concept? 回答1: I've used both PHPUnit & SimpleTest and I found SimpleTest

How to unit test a method that runs into an infinite loop for some input?

落花浮王杯 提交于 2019-12-09 02:27:57
问题 This question just occurred to my mind and I want to ask this here. The case is intentional, I just write a loop which runs infinitely. How do I go about unit testing it? I ask this because, this situation may occur anywhere in the code. Say my method delegates to several other methods, and I want to know How it ran into an infinite loop What set of input caused it Call to which method (from this method) has caused this I have no code written for this. The question is purely for knowledge

Test environment in Node.js / Express application

て烟熏妆下的殇ゞ 提交于 2019-12-09 00:36:11
问题 I've just starting working with Node, and I've been following along with various tutorials. I've created an Express app, and setup Mongoose and Jasmine. How can I configure my specs so that I can: create models, automatically clean them up after each spec use a different database for creating test objects (say myapp_test) do this in a way that is as DRY as possible, i.e. not creating a before / after block with the teardown for each describe block ? 回答1: I'll try to answer you. Create models,