Mansur
Mansur

Reputation: 1839

How test driven development is done in Spring?

As I mentioned in the title, I'm interested in how TDD is done in Spring. I am quite new to the notion of unit testing. I've read some articles about TDD. It is said that in TDD, first the tests are written based on requirements, they fail, then with the correct implementation, they succeed. But what should be tested in Spring? The main question is how they should be tested. I have no clue about how I should start, how to evaluate that what should be tested. I am searching for correct methods or conventions to write test-driven code if there's any.

Thanks in advance

Upvotes: 0

Views: 132

Answers (1)

Hemant Singh
Hemant Singh

Reputation: 1608

TDD is not dependent on the framework you are using. TDD is about the mindset and designing your code based on the failing requirement that's why we write down tests first. https://medium.com/@mithunsasidharan/test-driven-development-an-overview-46ebc817d580

The framework like Spring makes it easier to write down test cases using principles like Dependency Inversion. And they also provide all unit testing libraries dependencies.

You can check Mockito, Junit to go ahead with testing your code. https://site.mockito.org/

I will avoid testing the framework functionalities, I would be more interested to test my business logic in it and TDD helps me deigning in a better way.

Upvotes: 1

Related Questions