tdd

“Hello World” - The TDD way?

帅比萌擦擦* 提交于 2019-12-02 17:41:42
Well I have been thinking about this for a while, ever since I was introduced to TDD. Which would be the best way to build a "Hello World" application ? which would print "Hello World" on the console - using Test Driven Development. What would my Tests look like ? and Around what classes ? Request: No " wikipedia-like " links to what TDD is, I'm familiar with TDD. Just curious about how this can be tackled. You need to hide the Console behind a interface. (This could be considered to be useful anyway) Write a Test [TestMethod] public void HelloWorld_WritesHelloWorldToConsole() { // Arrange

Is there a python equivalent for RSpec to do TDD?

放肆的年华 提交于 2019-12-02 17:41:00
I'm looking for a test framework like Ruby's RSpec to do test driven development in Python. The advantage of a framework like RSpec is that it offers a DSL that lends itself well to TDD. First you describe the test in english, and then you write the test, and when it fails you get a message saying what test failed with your nice description of what the test is trying to do. So far I've looked at PyTest and Nose. PyTest seems closer to ruby's MiniTest than RSpec. Instead of offering a DSL with language to make it read like specifications, it focuses on assertions. Nose seems like a wrapper on

Zend Framework integration with Behat BDD

…衆ロ難τιáo~ 提交于 2019-12-02 17:39:19
Anyone has been using Behat with Zend Framework? Any examples on how to use both? curtisdf I got it working. It works with PHPUnit and Zend_Test so you can use all those nifty assertXYZ() methods. First, make sure you've got behat installed and available in your system $PATH . I did the following: sudo pear channel-discover pear.symfony.com sudo pear channel-discover pear.behat.org sudo pear install behat/behat Now, create a directory structure like so: features application ControllerTestCase.php bootstrap FeatureContext.php homepage.feature The features/application/ControllerTestCase.php

Mock objects - Setup method - Test Driven Development

时光总嘲笑我的痴心妄想 提交于 2019-12-02 17:28:27
I am learning Test Driven Development and trying to use Moq library for mocking. What is the purpose of Setup method of Mock class? Igor Zevaka The default behaviour of a Moq Mock object is to stub all methods and properties. This means that a call to that method/property with any parameters will not fail and will return a default value for the particular return type. You call Setup method for any or all of the following reasons: You want to restrict the input values to the method. public interface ICalculator { int Sum(int val1, val2); } var mock = new Mock<ICalculator>(); mock.Setup(m=>m.Sum

Are there any good online tutorials to TDD for an experienced programmer who is new to testing? [closed]

不羁的心 提交于 2019-12-02 17:21:59
I'm working with a Python development team who is experienced with programming in Python, but is just now trying to pick up TDD. Since I have some experience working with TDD myself, I've been asked to give a presentation on it. Mainly, I'm just wanting to see articles on this so that I can see how other people are teaching TDD and get some ideas for material to put in my presentation. Preferably, I'd like the intro to be for Python, but any language will do as long as the examples are easy to read and the concepts transfer to Python easily. Samuel Carrijo One suggestion I'd make is to start a

After using Automapper to map a ViewModel how and what should I test?

时光毁灭记忆、已成空白 提交于 2019-12-02 17:19:51
I am attempting to test the Index action of a controller. The action uses AutoMapper to map a domain Customer object to a view model TestCustomerForm . While this works I am concerned about the best way to test the results that I am receiving from the Index action. The controller's index action looks like this: public ActionResult Index() { TestCustomerForm cust = Mapper.Map<Customer, TestCustomerForm>(_repository.GetCustomerByLogin(CurrentUserLoginName)); return View(cust); } And its TestMethod looks like this: [TestMethod] public void IndexShouldReturnCustomerWithMachines() { // arrange var

Test Driven Development with C++

怎甘沉沦 提交于 2019-12-02 17:12:55
Looking to start doing TDD in C++. I've seen CPPUnit, but I was wondering if there are other options that people prefer? Thanks for your suggestions! Tobias Furuholm I can recommend Google Mock . It comes with a copy of Google Test bundled. We switched from UnitTest++ too Google Test/Google Mock a couple of years ago and have never looked back. Google Mock can be used even if you don't want to use the mocking facilities. Its matchers are very useful . I switched from CppUnit to boost::test some years ago and I'm much happier with it. Documentation for CppUnit is nonexistent. Good luck trying

Should unit tests be written before the code is written?

☆樱花仙子☆ 提交于 2019-12-02 17:11:56
I know that one of the defining principles of Test driven development is that you write your Unit tests first and then write code to pass those unit tests, but is it necessary to do it this way? I've found that I often don't know what I am testing until I've written it, mainly because the past couple of projects I've worked on have more evolved from a proof of concept rather than been designed. I've tried to write my unit tests before and it can be useful, but it doesn't seem natural to me. Some good comments here, but I think that one thing is getting ignored. writing tests first drives your

How to use Capybara in pure Ruby (without Rails)?

对着背影说爱祢 提交于 2019-12-02 17:05:23
I'm trying to get Capybara running in a simple Ruby script -- i.e. without/outside of Rails. Here's the script: require 'rubygems' require 'capybara' require 'capybara/dsl' include Capybara Capybara.current_driver = :selenium Capybara.app_host = 'http://www.google.com' visit('/') The problem is that when I run this I get this error: NameError: uninitialized constant Capybara::Session at top level in dsl.rb at line 52 method gem_original_require in custom_require.rb at line 36 method require in custom_require.rb at line 36 at top level in capybara_test.rb at line 3 method gem_original_require

How can Meteor apps be tested? [closed]

折月煮酒 提交于 2019-12-02 17:01:09
What are the recommended ways to test web applications developed with the meteor framework? The meteor unofficial FAQ entry on TDD best practices is quite short. Sebastian Maier has a repository where he created a meteor app and tests it with Jasmine. You could check it out, here's a link . The Meteor documentation is woefully and/or intentionally silent on the subject of testing, other than this one quote: Great care has been taken to give the core Meteor packages the minimal set of dependencies, so you can use your favorite templating, testing, or DOM manipulation frameworks. So I guess you