tdd

How to do TDD and unit testing in powershell?

强颜欢笑 提交于 2019-11-27 10:54:54
With MS ramming powershell into all new server products, I'm starting to (reluctantly) think I need to take it seriously. Part of "taking it seriously" is TDD. Have you found good methods to unit test power shell scripts? I've found samples of mocking from Mr Geek Noise - but I'd really like something like RhinoMocks . Brian Hartsock has a sample of running tests on powershell strings from MS Test. A little hacky, but it seems to work. What I want is a Powershell TDD experience that is as clean as it is in "real" languages. Update to clarify: The first two answers attempt to steer me away from

design of mid-large sized application when doing TDD? [closed]

好久不见. 提交于 2019-11-27 10:35:26
问题 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 . I have a good grasp of unit testing, DI, mocks, and all the design principal goodness required to have as close to full code coverage as humanly possible (single responsibility principal, think 'how will i test this' as I code, etc...). My most recent app, I did not code

Do polymorphism or conditionals promote better design?

情到浓时终转凉″ 提交于 2019-11-27 10:32:01
I recently stumbled across this entry in the google testing blog about guidelines for writing more testable code. I was in agreement with the author until this point: Favor polymorphism over conditionals: If you see a switch statement you should think polymorphisms. If you see the same if condition repeated in many places in your class you should again think polymorphism. Polymorphism will break your complex class into several smaller simpler classes which clearly define which pieces of the code are related and execute together. This helps testing since simpler/smaller class is easier to test.

Is it feasible to introduce Test Driven Development (TDD) in a mature project? [closed]

浪子不回头ぞ 提交于 2019-11-27 10:30:42
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Say we have realized a value of TDD too late. Project is already matured, good deal of customers started using it. Say automated

F# development and unit testing?

我只是一个虾纸丫 提交于 2019-11-27 10:21:57
I just got started with F#, which is my first functional language. I have been working quasi-exclusively with C#, and enjoy a lot how F# leads me to re-think how I write code. One aspect I find a bit disorienting is the change in the process of writing code. I have been using TDD for years in C# now, and really appreciate to have unit tests to know where I am at. So far, my process with F# has been to write some functions, play with them with the interactive console until I am "reasonably" sure they work, and tweak & combine. This works well on small-scale problems like the Euler Project, but

How can I use HTML fixtures with Karma test runner using Qunit?

与世无争的帅哥 提交于 2019-11-27 10:20:59
问题 I'm playing with Karma test runner (http://karma-runner.github.io/0.8/index.html) using qunit (http://qunitjs.com). I succesfully created and ran simple tests (100% JavaScript), but now I'm trying to use HTML fixtures in order to test code that interacts with DOM nodes. I'm able to load these fixtures by declaring them in "files" in this way: {pattern: 'fixtures/myfixture.html', watched: true, served: true, included: false} it get served by karma's server, but I don't understand how can I

PHPUnit: how do I mock multiple method calls with multiple arguments?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 09:57:41
问题 I am writing a unit test for a method using PHPUnit. The method I am testing makes a call to the same method on the same object 3 times but with different sets of arguments. My question is similar to the questions asked here and here The questions asked in the other posts have to do with mocking methods that only take one argument. However, my method takes multiple arguments and I need something like this: $mock->expects($this->exactly(3)) ->method('MyMockedMethod') ->with($this->logicalOr(

How to get started on TDD with Ruby on Rails? [closed]

送分小仙女□ 提交于 2019-11-27 09:56:05
I am familiar with the concepts (took testing classes in college), but I am not sure how to really use them yet since I never worked on a "real" TDD project. I am about to start the development of a project using Ruby on Rails (most likely using 2.3). This application will be used to manage data, users and some files. It won't be too complicated at first but might scale a lot in the next 6 months so I feel this is the right time to get more into TDD. I've got a basic idea on how to do it, but I still need some pointers and advices: What Ruby on Rails TDD 101 article should I read? What do I

When to unit-test vs manual test

跟風遠走 提交于 2019-11-27 09:50:51
问题 While unit-testing seems effective for larger projects where the APIs need to be industrial strength (for example development of the .Net framework APIs, etc.), it seems possibly like overkill on smaller projects. When is the automated TDD approach the best way, and when might it be better to just use manual testing techniques, log the bugs, triage, fix them, etc. Another issue--when I was a tester at Microsoft, it was emphasized to us that there was a value in having the developers and

Unit tests vs integration tests with Spring

你说的曾经没有我的故事 提交于 2019-11-27 09:46:00
问题 I'm working on a Spring MVC project, and I have unit tests for all of the various components in the source tree. For example, if I have a controller HomeController , which needs to have a LoginService injected into it, then in my unit test HomeControllerTest I simply instantiate the object as normal (outside of Spring) and inject the property: protected void setUp() throws Exception { super.setUp(); //... controller = new HomeController(); controller.setLoginService( new SimpleLoginService()