12 votes

Should i write tests if it takes more time than testing manually?

Lets take this XKCD literally: You wrote it took you 30 minutes to automate a task which manually takes 30 seconds. Now lets make the conservative assumption that you will run your automated test ...
Doc Brown's user avatar
  • 203k
11 votes

Integration vs Functional Testing

1) Is this a functional test or an integration test? Functional testing and integration testing are classifications of tests, and they are not mutually exclusive. In this case it's both. Integration ...
Samuel's user avatar
  • 9,167
11 votes

Should you clean up your DB after integration tests?

You need to do it before every test, obviously, in order for the test not to be affected by other tests. On the other hand, keep the data in the database after the test in order to make it easier to ...
Arseni Mourzenko's user avatar
10 votes
Accepted

Should integration test coverage allow for lower unit test code coverage?

If a project has 30% coverage by unit tests, 40% due to integration tests, is it fair to say the total is 70% as so moderately well covered? Only if there is zero overlap between the 40% covered by ...
Jörg W Mittag's user avatar
9 votes

Should test code be treated as normal code?

I remember reading on someone else's post that test code should not be treated as normal code but as small whole programs and that is an idea I really like and would like to refer to when discussing ...
VoiceOfUnreason's user avatar
9 votes

Should on each test create and nuke a testing database?

Tests should be independent of each other and reproduceble. This can be done with complete database setup for every test as you described or with a predefined database-content where a database-...
k3b's user avatar
  • 7,498
8 votes
Accepted

Unit testing Systems with Logic Tightly Coupled with Data

I've implemented automated testing including the database in a system with some of the same problems. The approach I took was roughly: Before all unit tests, bring up a DB from scratch with schema ...
Daenyth's user avatar
  • 8,097
8 votes

Integration tests, but how much?

Contrary to this answer, I find testing at different levels important part of software testing process. Unit, functional, integration, smoke, acceptance and other kind of tests are testing different ...
BЈовић's user avatar
7 votes
Accepted

Integration tests, but how much?

There is a school of thought that seriously questions the value of integration tests. I suspect you'll get a broad spectrum of answers here, but to my mind you should only use them when they deliver ...
Robbie Dee's user avatar
  • 9,737
7 votes

Should test code be treated as normal code?

Definitively, the testing code worth be treated with so much care as the production code for the next reasons Testing code is an important documentation resource. Testing code speaks about the system ...
Laiv's user avatar
  • 14.5k
7 votes
Accepted

Clean Architecture use case testing

or is it just Unit Testing? There is nothing "just" about Unit Testing. The distinction between Integration Testing and Unit Testing seems to be different in every shop. However, the most ...
candied_orange's user avatar
5 votes
Accepted

How can I unit test this code

The simple answer is probably "you can't unit test this code". You say yourself that the functions are too long and that they're doing multiple tasks. Therefore you have two choices: Don't write unit ...
Philip Kendall's user avatar
5 votes

Is creating a completely duplicate system for quality assurance (QA) of another a bad practice?

O_A is wrong, O_B is right Fix A O_A is right, O_B is wrong Fix B O_A is right, O_B is right Hopefully, they also agree. O_A is wrong, O_B is wrong Hopefully, they ...
candied_orange's user avatar
5 votes

the actual notion of an integration and end to end testing

I think what you're realising here is that your definition of an end-to-end test we send a request and expect a response is incomplete. Not everything has requests and responses, yet it's still ...
Philip Kendall's user avatar
5 votes

the actual notion of an integration and end to end testing

Tests are code. They have requirements. You've clearly gathered the requirements for this test and they involve knowing the state of the Data Base. Fine. Create that test. I want to know how rigid do ...
candied_orange's user avatar
4 votes

Good approach/Strategy to keep integration test database in-sync with production db?

Well, you wrote When i setup my integration tests a while back i took a SQL dump from production db and converted that to HSQL (DDL & inserts). so automate this process - build some scripts ...
Doc Brown's user avatar
  • 203k
4 votes

Unit testing Systems with Logic Tightly Coupled with Data

Assuming all logic is within your DB, in stored procedures, and you simply cannot change that in your project, I'd do the following: (optional) Refactor your stored procedures in order that each one ...
Emerson Cardoso's user avatar
4 votes

How do you unit test a microservice that makes a call to another microservice?

You are confusing unit test with integration tests: Unit tests You want to test your ConnectorTypeA. Meaning you only care for ConnectorTypeA output given certain inputs. If it calls ...
Christopher Francisco's user avatar
4 votes

A performant and robust way to reset multiple files to its original state (TDD)

Use a memory-based file system that can be re-created at the start of each test. In the Java ecosystem, JimFs is very competent for this. It does require injection of the file system into the ...
BobDalgleish's user avatar
  • 4,664
4 votes
Accepted

If I am mocking API responses in my unit/integration tests, how do I guarantee that the contract between Service A and B are valid?

If I'm simply mocking the API call & response between Microservice A and B, how does that enforce the contract for B, in that, B requires parameters 1, 2, and 4? If you mock the test such that ...
Telastyn's user avatar
  • 109k
4 votes
Accepted

What would be an ideal unit test in this simple case?

Here even the unit tests seem to be dependent on the stubs. A part of my brain says that this is an integration test rather than unit test. ArticleService is dependent on an instance of ...
David Arno's user avatar
  • 39.1k
4 votes
Accepted

Additional modules in unit tests

What you describe is the difference between solitary unit tests and sociable unit tests. The developer writing the code is advocating for sociable unit tests, while it seems like the team's standard ...
Thomas Owens's user avatar
  • 80.4k
4 votes

Is it possible to prove mathematically that unit testing reduces test effort as compared to integration testing?

I am not convinced that unit testing beats integration testing hands down in terms of man hours. Unit testing is not something that can beat integration testing. Unit testing is an effective way to ...
candied_orange's user avatar
3 votes
Accepted

How do you unit test a microservice that makes a call to another microservice?

When ConnectorTypeA is created, it needs to register itself with ConnectorRegistrar When ConnectorTypeA is created, it needs to be given a means of registering itself with something else. What that ...
David Arno's user avatar
  • 39.1k
3 votes

Keeping Stubs in Sync?

When testing the interface between two parts, the easiest way is to test those parts together, i.e. perform integration tests. If you want to test each part in isolation (i.e., perform component/unit ...
amon's user avatar
  • 134k
3 votes

Where do I define WCF client endpoints in a test project?

There is a simple trick you can use. Visual Studio will load the app.config for the test project into it's host process if it's present. However, test projects don't usually have app.configs. You can ...
T. Sar's user avatar
  • 2,044
3 votes
Accepted

Do you have to use an in-memory db for integration testing?

Do you have to use an in-memory database? No, you don't have to. But depending on what kind of application you are developing, and depending on what kind of tests you are going to implement, it can ...
Doc Brown's user avatar
  • 203k
3 votes

Sequence of Integration Test in Build Process

Test as much as possible before deployment Deployment isn't cheap. Even if the deployment is fully automated and pushed automatically from the commit it still takes time to deploy, it prevents any ...
JDT's user avatar
  • 6,320
3 votes

Whether and how to test façades

You have to distiguish between whitebox tests and blackbox tests. As blackbox tests do not know, how a component behaves, you have no clue if the called method is only a delegate or complex logic. As ...
oopexpert's user avatar
  • 769
3 votes

Is it mandatory to run integration tests when deploying feature branches to QA machines

You should not be running integration/smoke tests ever time you build. You should not be deploying to a QA machine without passing their basic tests. You should not expect passing their tests to ...
candied_orange's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible