tdd

Test Driven Development in PHP

冷暖自知 提交于 2019-12-02 14:06:37
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? I've used both PHPUnit & SimpleTest and I found SimpleTest to be easier to use. As far as TDD goes, I haven't had much luck with it in the purest sense. I think that's

Team Foundation Build or TeamCity?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 14:06:21
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 source control analysis. When demoing to managament, I think they started to buy into my snake oil and

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

左心房为你撑大大i 提交于 2019-12-02 14:06:12
How can I assert my Ajax request and test the JSON output from Ruby on Rails functional tests? nicholaides 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. Rails has JSON support built in: def json_response ActiveSupport::JSON.decode @response.body end No need for a plugin Then you can do something like this:

Unit Testing of private methods in Xcode

青春壹個敷衍的年華 提交于 2019-12-02 14:00:40
I'm trying out test driven development in a toy project. I can get the tests working for the public interface to my classes (although I'm still on the fence because I'm writing more testing code than there is in the methods being tested). I tend to use a lot of private methods becuase I like to keep the public interfaces clean; however, I'd still like to use tests on these methods. Since Cocoa is a dynamic language, I can still call these private methods, but i get warnings in my tests that my class may not respond to these methods (although it clearly does). Since I like to compile with no

Useful design patterns for unit testing/TDD?

让人想犯罪 __ 提交于 2019-12-02 13:52:16
Reading this question has helped me solidify some of the problems I've always had with unit-testing, TDD, et al. Since coming across the TDD approach to development I knew that it was the right path to follow. Reading various tutorials helped me understand how to make a start, but they have always been very simplistic - not really something that one can apply to an active project. The best I've managed is writing tests around small parts of my code - things like libraries, that are used by the main app but aren't integrated in any way. While this has been useful it equates to about 5% of the

TDD/BDD screencast/video resources [closed]

半腔热情 提交于 2019-12-02 13:46:14
I've recently finished watching the Autumn of Agile screencasts and I'm looking for more material of similar scope. Basically, I'm looking for screencasts that present TDD/BDD process while developing somewhat "real life" applications (or parts of them) - so no 20 minute intros please. I'm surprised not to find anything like that though. If you know of any resources that fit the requirement, please list them. Brett Schuchert from Object Mentor just posted a series of videos on TDD The videos are meant to be watched in order. GettingStarted Adding Basic Operators Removing Duplication Extracting

Mocking iterative behaviour

若如初见. 提交于 2019-12-02 12:29:16
I have an interface with iterative behaviour, and I am having trouble Mocking that in Rhinomocks. The example interface and class is a very simple version of my problem. Every time LineReader.Read() is called, the LineReader.CurrentLine() should return a different value -- the next line. This behaviour I haven't been able to reproduce in a mock so far. Thus, it has become a small hobby project of mine which I return to from time to time. I hope you can help me a step further. internal class LineReader : ILineReader { private readonly IList<string> _lines; private int _countOfLines; private int

TDD - How to write test case for a method that as Assembly.LoadFrom(…)

隐身守侯 提交于 2019-12-02 11:53:36
问题 I have got method which is using Assembly.LoadFrom(...) statement and returns the supported cultures from that satellite assembly, so how could I write unit tests for that type of methods. What I did was, wrapped that static method/logic to return cultures in anther class and used it's instance method. Is this the right approach? 回答1: Is this the situation? aMethod(whatToLoad) { // other stuff x = Assembly.LoadFrom( whatToLoad ); // code using x } First principle: We are focusing on testing

Mocking values in TDD

血红的双手。 提交于 2019-12-02 06:14:39
问题 In the book GOOS. It is told not to mock values, which leaves me confused. Does it means that values don't have any behavior? I dont' much knowledge about the value object but AFAIK the value objects are those which are immutable. Is there any heuristic on deciding when to create a value object? 回答1: Not all immutable objects are value objects. By the way, when designing, consider that the ideal object has only immutable fields and no-arg methods. Regarding the heuristic, a valid approach can

How would I do TDD with a COM OLE object

喜欢而已 提交于 2019-12-02 05:00:49
问题 I have an OLE COM object that trying to write a wrapper for, I have decided to start to use TDD to write the code for it as I believe that it will give me a better sense of direction with what I'm try to write. The COM object has a interface like this: Interface Mapinfo Sub [Do](ByVal cmd As String) Function Eval(ByVal cmd As String) As String End Interface The [Do] command would take somthing like the following Mapinfo.Do("OpenTable("""C:\Temp\MyTable.TAB""")") Now I am trying to write a