Skip to main content

All Questions

-2 votes
2 answers
3k views

Best practices around writing testable extension methods

I’m currently working in C# and I’d like to write and extension method against a type. There is a small amount of repeated logic between classes surrounding JSON deserialization, using the ...
RTT's user avatar
  • 1
3 votes
1 answer
1k views

How to test channel pipelines in Go

I use the "channel pipeline" pattern quite a lot in Go, which looks something like this: // getSomeNums spits out ints onto a channel. Temperatures, pressures, doesn't matter func ...
Tal's user avatar
  • 141
-5 votes
1 answer
104 views

Should code be refactored to be more unit testable or should a framework like PowerMock be used?

Assume there's some code that's already in production that needs some unit testing. Generally speaking, would you want to refactor this code that's already in production by adding things like adding ...
JobHunter69's user avatar
-4 votes
3 answers
141 views

What can an assertion test that running the actual code cannot?

I'm currently learning Jest, Enzyme, Detox and testing in general, but I'm still trying to grasp the benefit of testing. From what I understand, testing is about creating hypothetical situations. Let'...
user avatar
0 votes
3 answers
233 views

Is is worth the time to create a list of manual regression tests for a legacy application?

I am part of a new dev team that is assigned to work on a legacy app. The app currently has no regression or automated unit, integration and system tests. Due to technical debt and convoluted ...
user avatar
2 votes
2 answers
369 views

How to organize my test functions? (Part II: Keepin' it classy)

What are the best practices to organize your unit tests in classes? I see different possibilities: 1) One would be to write one "container" class for each function you want test and then ...
l7ll7's user avatar
  • 263
24 votes
8 answers
4k views

Wouldn't it be beneficial to write tests during code review?

A colleague of mine came up with an idea that I found interesting. Wouldn't it be beneficial to write tests during code review, by the person doing the review assuming that we don't do TDD? For ...
Sok Pomaranczowy's user avatar
7 votes
2 answers
6k views

The concept of "quality gates" in software testing

We are using SonarQube for code quality testing. It tests the quality of code, and not the function of code. It has the concept of quality gates, so you can set for instance a 90% quality gate, ...
Nelfo's user avatar
  • 191
7 votes
6 answers
2k views

Is it an overkill to write unit tests for a small code base? [duplicate]

I am the sole maintainer of a code base of about 2000 lines of code. It's not big, but over time the code became so unmaintainable my boss agreed to give me time to rewrite it from scratch. Since the ...
Aviv Cohn's user avatar
  • 21.5k
0 votes
1 answer
369 views

Testing - How to test if you are actually testing the code?

I was thinking about unit tests and code coverage, and I came up with this thought: It is possible to have 100% code coverage and not test 100% of your code. For example: function myTestedFunction()...
Ari Porad's user avatar
  • 133
0 votes
1 answer
82 views

Testing - Test for Specific Paths?

When (unit) testing, is is bad to expect the code to use certain paths. For example, should I be testing for specifically "/build/static/public/css/", or just that server.cssPath has been set to a ...
Ari Porad's user avatar
  • 133
-4 votes
4 answers
289 views

How to use unit testing? [duplicate]

How to use unit testing? There are a lot of frameworks for different languages, which provide functionality of unit testing. There is a lot of information on how to use each of them technically. Just ...
Victoria Agafonova's user avatar
2 votes
1 answer
236 views

Testing MVC models when using SQL referential constraints

I have an MVC web app that's wired against PostgreSQL. The DB uses the full gamut of various referential constraints to ensure referential integrity, as opposed to say the Rails approach, where you ...
Alexandr Kurilin's user avatar
88 votes
11 answers
19k views

Is it a bad practice to modify code strictly for testing purposes

I have a debate with a programmer colleague about whether it is a good or bad practice to modify a working piece of code only to make it testable (via unit tests for example). My opinion is that it ...
liortal's user avatar
  • 1,185
16 votes
5 answers
41k views

How to unit test a jsp file?

I'm developing a Java 6 EE application and I'm testing my jsp code with another one with a testing version of the function calls and code used in the original one but it seems loose and impractical. ...
zamancer's user avatar
  • 161