BDD vs TDD - Is there a difference?

preview_player
Показать описание
I'm incorporating more Behaviour-driven Development into my work and wanted to highlight the differences in mindset and practical use.

####### LINKS #######
Рекомендации по теме
Комментарии
Автор

What's the difference?
Both are Tests methodologies
if that is test-Driven-Development, requires you to write test in conjunction with your development and have them inform your development decisions from the start. Aka writing tests before you write the implementation.
Testing single functions and their return types is called UNIT testing.
And is most often only useful to detect and prevent meaningful CHANGES to your code.
NOT to inform development from the start. But additions to it. It's a guard-rail for the future. (again it's just testing, if you aren't doing it in conjunction with development and have your tests inform the code you write, its not really driving your development now is it? Or well it is, if you don't draw a line between developing, extending and maintaining code)

It's not really to check that your code is "correct" or even behaves the way you want (when testing singular functions, aka units, it's impossible to know their behaviour in an app and all side-effects. You can have meaningful changes to a function that do not break unit tests, but will break your app and it's not bad unit test)
That' why you have INTEGRATION tests. (What I believe you think is behaviour?)

The difference you show, that instead of literally selecting the thing by ID that you expect your component to have,
you select a generic "button" and that's somehow different?
You could already do that? But it's bad practice to do generics in a unit test.

And what behaviour is this testing?
That the thing has a button to click?
That it outputs those outputs given these inputs?
That's NOT a Unit-test to you?

Would really like to see your code for jest test-case here, to bring my point home. That there's literally no difference except the use of a generic button selector instead of selecting element by id.

MrSofazocker
welcome to shbcf.ru