tdd

What's the state of TDD and/or BDD in PHP? [closed]

梦想的初衷 提交于 2019-12-04 07:52:28
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . How widespread, supported, developed is testing in the PHP world? On par with Java? Up there with Ruby/Rails? I Googled and found that testing frameworks

How to test JSON result from Ruby on Rails functional tests?

非 Y 不嫁゛ 提交于 2019-12-04 07:28:24
问题 How can I assert my Ajax request and test the JSON output from Ruby on Rails functional tests? 回答1: Use the JSON gem's JSON.parse, which takes a string as input and returns a Ruby hash that the JSON represents. Here's the basic gist for a test: user = JSON.parse(@response.body) assert_equal "Mike", user['name'] Here's documentation for the gem: http://json.rubyforge.org/. Also, you can play with the JSON gem in IRB pretty easily. 回答2: Rails has JSON support built in: def json_response

Test driven development book [closed]

社会主义新天地 提交于 2019-12-04 07:25:47
问题 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 5 years ago . What book would you recommend to learn test driven development? Preferrably language agnostic. 回答1: Test Driven Development By Example Refactoring: Improving the Design of Existing Code Extreme Programming: Embrace The Change 回答2: Growing Object-Oriented Software, Guided by Tests by Addison-Wesley - it is about

Is it impossible to use Guard with RubyMine?

穿精又带淫゛_ 提交于 2019-12-04 07:25:46
问题 For some inexplicable reason, RubyMine autosaves every change you make and so every key stroke will trigger Guard to run your tests! And the most ridiculous thing is that there's apparently no way to disable this autosaving "feature". I'm just wondering, RubyMine seems to be a very popular editor among Rails developers and Guard seems to be an indispensable tool used to automate testing. Since Guard is impossible to use reasonably with RubyMine, how do people deal with automating their tests

BDD and TDD for node.js?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 07:25:36
问题 What is used for BDD and TDD with node.js? I'm used to use Cucumber + RSpec. What's a good combo for node.js? thanks 回答1: Update Mocha gets my vote now! You could have a look at the testing modules section from the node.js modules page. For example Vows is a pretty popular BDD framework. Vows is a behavior driven development framework for Node.js. 回答2: Check out mocha - (github) Also mocha-cakes, my attempt for Cucumber syntax on mocha. 回答3: If you are used to rspec, Jasmine is pretty nice. I

How to run nosetests without showing of my matplotlib's graph?

99封情书 提交于 2019-12-04 06:47:34
I try to run my test without any messages displaying from my main program. I only want verbose messages from nosetests to display. For example: nosetests -v --nologcapture All of my printout messages from my main program will be gone. However, the graph that I call in my main program ( plt.show() from matplotlib) still shows up. How do I run the tests without matplotlib's graph showing up? Jay Atkinson I assume that you're calling unittests on your code, so my recommendation would be for you to install the python Mock library. Any tests that will exercise the plt.show() function should mock it

State/Interaction testing and confusion on mixing (or abusing) them

二次信任 提交于 2019-12-04 06:26:13
I think understand the definition of State / Interaction based testing (read the Fowler thing, etc). I found that I started state based but have been doing more interaction based and I'm getting a bit confused on how to test certain things. I have a controller in MVC and an action calls a service to deny a package: public ActionResult Deny(int id) { service.DenyPackage(id); return RedirectToAction("List"); } This seems clear to me. Provide a mock service, verify it was called correctly, done. Now, I have an action for a view that lets the user associate a certificate with a package: public

Version control and test-driven development

倖福魔咒の 提交于 2019-12-04 06:14:46
The standard process for test-driven development seems to be to add a test, see it fail, write production code, see the test pass, refactor, and check it all into source control. Is there anything that allows you to check out revision x of the test code, and revision x-1 of the production code, and see that the tests you've written in revision x fail? (I'd be interested in any language and source control system, but I use ruby and git) There may be circumstances where you might add tests that already pass, but they'd be more verification than development. A couple of things: After refactoring

Visual studio parameterized unit test like java

南笙酒味 提交于 2019-12-04 06:03:07
In a Java test environment I can use parameterized unit tests as in the following code: @RunWith(value = Parameterized.class) public class JunitTest6 { private int number; public JunitTest6(int number) { this.number = number; } @Parameters public static Collection<Object[]> data() { Object[][] data = new Object[][] { { 1 }, { 2 }, { 3 }, { 4 } }; return Arrays.asList(data); } @Test public void pushTest() { System.out.println("Parameterized Number is : " + number); } } How can I do this in a Visual Studio unit test project? I can`t find any parameterized attribute or any sample like this.

stubbing ES6 super methods using sinon

风格不统一 提交于 2019-12-04 05:52:05
I am having a problem stubbing the base class methods using Sinon. In the example below I am stubbing the call to base class method GetMyDetails as follows. I am sure there is a better way. actor = sinon.stub(student.__proto__.__proto__,"GetMyDetails"); And also the value of this.Role ends up being undefined. I have created a simple class in javascript "use strict"; class Actor { constructor(userName, role) { this.UserName = userName; this.Role = role; } GetMyDetails(query,projection,populate,callback) { let dal = dalFactory.createDAL(this.Role); dal.PromiseFindOneWithProjectionAndPopulate