I want to know what is the importance of test-driven development with Selenium/Webdriver?

Is it a framework ?


TDD always means the unit test to drive the development, not the function test or system test. and Selenium is a framework for the GUI test which is mainly applied in the function test.

so based on my experience, the Selenium is not a suitable framework for the TDD process.

from my opinion, Selenium is useful when the web is a mature web with stable functions. if the web is not mature and needs to be often changed,then it will cause big efforts in the maintenance of Selenium cases.

  • Alternatively, have a look at Behavior-Driven Development or BDD); where you drive the development based on expected functionality, so outside-in, as opposed to the inside-out development with TDD. Although also with BDD Selenium is still not the proper tool, as the idea of expressing the intended functionality is to not include implementation details (which you would have using Selenium tied to front end). – Marit Jan 26 '18 at 9:36

Test-Driven Development is a way of of developing software, its a practise. It is a process you can follow. You write a failing tests and implement just enough code to make the test pass, afterwards you clean or refactor your code and create a new failing test. Repeat this cycle until your software is done.

Mostly TDD is used with unit-tests and less with integration or functional tests.

Now writing Selenium tests first is not something that is done often, because you do not know yet how your web-page design will be. Although it can certainly be done. More often a BDD (Behaviour-Driven Development) cycle is used. In BDD the external or user behaviour is described and executed by the tests. Still it uses the same cycle, describe the behaviour first before you do the actual coding. (its the same as TDD, but more descriptive to communicate between users and developers)

The main thing here is just to write test-cases first before doing any coding, but one test at a time.

If TDD is important, thats too objective to answer, but I think its important to understand. It is a process and a handy tool for developers to solve certain software problems. Understand when and why it is practical. I would execute a couple of TTD coding kata's to get the grasp of it.

More information:

Your Answer
