Linked Questions

4 votes
1 answer
3k views

Testing a function that only calls one or two other functions [duplicate]

The short version The code As part of TDD, we often end up with functions that follow this pattern: function onSendRequestForSelected() { this.deselectStepsWithRequest(); this....
user avatar
  • 361
2 votes
2 answers
782 views

Value of unit testing property setters to check events [duplicate]

When coding in WPF with the MVVM pattern, it's common to see a lot of property get/set statements that raise an event, which can then be picked up by the UI layer. public string Address { ...
user avatar
  • 3,526
2 votes
1 answer
698 views

Unit testing trivial cases [duplicate]

Currently we don't do much testing at our company, except some manual checking. We occasionally create some unit tests, integration tests and ui tests, but not on a regular basis. Since a new project ...
user avatar
4 votes
0 answers
168 views

unit testing a mocked class [duplicate]

I'm currently writing unit tests for my PHP code. I've read that unit tests should not interract with external elements such as network and filesystem. In my code i have a curl wrapper class to ...
user avatar
149 votes
14 answers
24k views

When is it appropriate to not unit test?

I work in a small company as a solo developer. I'm the only developer at the company in fact. I have several (relatively) large projects I've written and maintain regularly, and none of them have ...
user avatar
  • 1,813
100 votes
10 answers
11k views

Where is the line between unit testing application logic and distrusting language constructs?

Consider a function like this: function savePeople(dataStore, people) { people.forEach(person => dataStore.savePerson(person)); } It might be used like this: myDataStore = new Store('some ...
user avatar
  • 1,416
3 votes
2 answers
465 views

My unit test looks very similar to the class I'm testing. How do I support my stance that the test is, in fact, correct?

I'm working on a boilerplate component that's supposed to generate a working sort-of "getting started" project structure. Think of it, in a web app context, of a component that will generate a ...
user avatar
7 votes
2 answers
1k views

How to decide what forms the System Under Test

Ok, so we started with the initial version of "The Art Of Unit Testing" and we do unit tests for classes where every test covers one aspect of one method. This has the drawback of high maintenance ...
user avatar
0 votes
3 answers
598 views

What concept am I missing with private methods and testing? [duplicate]

I've read a lot o blogs arguing about private methods and testing. Some people say you should not test private methods, they say you should make them public or put those methods in a new class. But ...
user avatar
0 votes
1 answer
112 views

Dry refactoring against database

Our database has an Attribute table and a WorkItem table that are in a many to many relationship using a WorkItemAttribute table. The WorkItemAttribute table contains the foreign keys for each and a ...
user avatar