Tag Info

New answers tagged

3

For a good definition of Test Driven Development, I suggest you read Doc Brown's post. Here is how I would answer a similar question: All three practices are not mutually exclusive and can be combined into the larger software development process. Developing based on User Stories in iterative development cycles (Agile) does not exclude the engineering ...


0

TDD means writing unit tests, before writing the code. Your unit tests are the documentation, and they dictate the design. Integration tests is testing how group of modules integrate together. It comes after unit testing. Agile methodology is the way you organize your process, in order to faster respond to requirements changes. That usually means ...


2

The important thing is to distinguish between TDD and ATDD. The AT there stands for "acceptance tests", and this refers to development where you first start with an acceptance test, which is likely to test the entire stack. This is also sometimes called "outside-in test driven development". When people talk about TDD, the "T" there probably refers ...


7

Is there a technique for unit testing both components in one run? That would actually be the opposite of unit testing - unit testing, especially in TDD style, means to test your components in isolation. Thus the answer is yes, "run separate test suites for the JS and PHP sections", otherwise it is not unit testing and not TDD. Of course, automated ...


-2

Developer Documentation How do I (as another developer) know that this has been tested? If I want to fix a bug in the self contained function, how do I know that I am not introducing a bug that you had already considered? Complexity indicator: # of tests can be a good measure of how complex something is. This may indicate that you shouldn't touch it ...


2

Reality Check I have been in challenging environments where testing is "a waste of time" during budgeting and schedule, and then "a fundamental part of quality assurance" once the customer is dealing with bugs, so my opinion is more fluid than others might be. You have a budget. Your job is to get the best product you can on that budget, for whatever ...


0

Yes, keep the tests, keep them running and keep them passing. Unit tests are there to protect you (and others) from yourself (and themselves). Why is keeping the tests a good idea; Validate the previous requirements' functionality in the face of new requirements and additional functionality Verify that refactoring exercises are correct Internal ...


43

Because nothing is so simple that there can't be bugs. Your code, while on the face of it looks to be bug free. It is in fact a simple programmatic representation of a polynomial function. Except it has a bug... public function polynominal($a, $b, $c, $d) { return $a * pow($x, 3) + $b * pow($x, 2) + $c * $x + $d; } $x is not defined as an input to ...


12

Everything said in the other answers is correct, but I will add one more. Documentation Unit tests, if well written, can explain to a developer exactly what a function does, what its input/output expectations are, and more importantly, what behavior can be expected of it. It can make spotting a bug easier and lower confusion. Not everybody remembers ...


76

Regression testing It's all about regression testing. Imagine the next developer looking at your method and noticing that you are using magical numbers. He was told that magical numbers are evil, so he creates two constants, one for the number two, the other one for the number three—there is nothing wrong in doing this change; it's not like he was ...


20

Yes. If we could say with 100% confidence, with certainty: this function will never be edited and will never run in a context which could cause it to fail - if we could say that, we could drop the tests and save a few milliseconds on every CI build. But we can't. Or, we can't with many functions. And it's simpler to have a rule of running all the tests ...


7

Generally, one would better be judicious about using protected access at all. The reasons for that are laid out in answers to prior questions over here: Why is Clean Code suggesting avoiding protected variables? As for using it the way you think of here - weakening access limitation because it feels like more comfortable to test - it looks like a terribly ...


1

A very clean way is using Git: Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. For more information and downloads: https://git-scm.com With Git you use branches, such as develop, master, feature/, etc. Read more here: ...


0

Without seeing the actual code or tests it's hard to say, but why do you need to actually use the service in the test? You'd be better off mocking the ebay API and not worrying about live/production differences.


2

You don't need a setting that says if you are in development or production or not. You just need settings that tell your application how to handle certain things. API keys, database connection strings,... these are all basic 'read this value and use it' things and this is the kind of stuff that configuration files are good at. It's a little different if ...


0

One solution I've used in the past is to have the application use the hostname of the machine it's running on to locate the configuration file, so if it's running on a machine called www7, it'll load config.www7.inc, whereas if it's running on minerva it'll load config.minerva.inc. It takes a moment to set up a new machine, but after that it's pretty easy.


0

One solution that sounds vaguely reasonable stems from this 12 factor methodology page on configuration. The most focused guidance I have found so far is here in the 12 factor methodology. They suggest that such configurations should be stored in environment variables. But how would that be done in PHP? Here it is suggested to use a .htaccess file.


3

Don't write GUI tests to match the GUI. Write acceptance tests that match requirements You could write your tests like this: Given I enter "user" into the username field and "pass" into the password field And I click the "Login" button When I click the Find User button And I enter "foo" into the username field And I click "Search" Then I should see a ...



Top 50 recent answers are included