tdd

Research on TDD

馋奶兔 提交于 2019-12-03 12:29:35
问题 I know there is done some research on TDD at the North Carolina State University. They have published a paper called 'An Initial Investigation of Test Driven Development in Industry'. Other publications by NCSU can be found here. Can anybody point me to other good publications on this topic? 回答1: On the Effectiveness of the Test-First Approach to Programming, by Hakan Erdogmus, Maurizio Morisio, and Marco Torchiano. Despite the name it covers TDD: Abstract: Test-Driven Development (TDD) is

TDD: Why is there only one test per function?

我只是一个虾纸丫 提交于 2019-12-03 12:04:58
I'm having a hard time understanding why there is only one test per function in most professional TDD code that I have seen. When I approached TDD initially I tended to group 4-5 tests per function if they were related but I see that doesn't seem to be the standard. I know that it is more descriptive to have just one test per function because you can more easily narrow down what the problem is, but I find myself struggling to come up with function names to differentiate the different tests since many are so similar. So my question is: Is it truly a bad practice to put multiple tests in one

Unit testing the Viewmodel

自闭症网瘾萝莉.ら 提交于 2019-12-03 12:02:44
问题 I am sort of new to TDD. I have started creating the properties I need on the view model as plain auto property. public string Firstname { get; set; } Then I create a test [TestMethod] [Tag("Property")] public void FirstNameTest() { ViewModel = new CustomerViewModel(); ViewModel.PropertyChanged += (s, e) => { Assert.AreEqual("Firstname", e.PropertyName); Assert.AreEqual("Test", ViewModel.Firstname); }; ViewModel.Firstname = "Test"; } Then I would extend the actual implementation to make the

Using Moq and TDD, where to start?

浪尽此生 提交于 2019-12-03 11:55:44
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 my tests, if I want to test deeper functionality? I recommend two books: Test Driven Development by

mocha init timeout with mocha-phantomjs

不羁岁月 提交于 2019-12-03 11:38:44
I have the following testrunner.html : <html> <head> <title>Specs</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="/content/css/mocha.css" /> <script> function assert(expr, msg) { if (!expr) throw new Error(msg || 'failed'); } </script> <script src="/client/lib/require.js" type="text/javascript" data-main="/client/specs/_runner.js"></script> </head> <body> <div id="mocha"></div> </body> </html> The _runner.js looks like this: // Configure RequireJS require.config({ baseUrl: '/client', urlArgs: "v=" + (new Date()).getTime() }); // Require

Testing Python Scripts

无人久伴 提交于 2019-12-03 11:36:26
How do I test the STDOUT output of a Python script with a testing framework like doctest, unittest, nose, etc? For example, say running my script "todo.py --list" should return "take out the garbage". I've read someone who separates out the STDOUT printing part of the script from the part that generates the output to be printed. I'm used to sprinkling print statements all around my shell scripts. Is this simply a TDD unfriendly habit I should break or is there a way to easily test for correct print output? Christophe de Vienne I see two ways : Redirect stdout during the unittest: class

RhinoMocks: Correct way to mock property getter

杀马特。学长 韩版系。学妹 提交于 2019-12-03 11:08:50
I'm new to RhinoMocks, and trying to get a grasp on the syntax in addition to what is happening under the hood. I have a user object, we'll call it User, which has a property called IsAdministrator. The value for IsAdministrator is evaluated via another class that checks the User's security permissions, and returns either true or false based on those permissions. I'm trying to mock this User class, and fake the return value for IsAdministrator in order to isolate some Unit Tests. This is what I'm doing so far: public void CreateSomethingIfUserHasAdminPermissions() { User user = _mocks

Python unittesting: run tests in another module

安稳与你 提交于 2019-12-03 10:48:44
I want to have the files of my application under the folder /Files, whereas the test units in /UnitTests, so that I have clearly separated app and test. To be able to use the same module routes as the mainApp.py, I have created a testController.py in the root folder. mainApp.py testController.py Files |__init__.py |Controllers | blabla.py | ... UnitTests |__init__.py |test_something.py So if in test_something.py I want to test one function that is in /Files/Controllers/blabla.py, I try the following: import unittest import Files.Controllers.blabla as blabla class TestMyUnit(unittest.TestCase):

Googletest for Android NDK

爱⌒轻易说出口 提交于 2019-12-03 10:47:45
I checked a previous answer about unit test for Android, where it is suggested Googletest as a good option . However, I got a look into the Google C++ Testing Framework - Googletest . About platforms, I don't see anything mentioning support to Android. Could someone tell anything, if there is some way of using it with Android devices - e.g. steps to build a toolchain, etc? You need to built Googletest for Android to be able to run it with your toolchain, as you working with cross-compilation. Download source code of googletest $ mkdir googletest $ cd googletest $ svn checkout http://googletest

Best practice for integrating TDD with web application development?

北慕城南 提交于 2019-12-03 10:44:33
问题 Unit testing and ASP.NET web applications are an ambiguous point in my group. More often than not, good testing practices fall through the cracks and web applications end up going live for several years with no tests. The cause of this pain point generally revolves around the hassle of writing UI automation mid-development. How do you or your organization integrate best TDD practices with web application development? 回答1: Unit testing will be achievable if you separate your layers