0

What's the best/most advanced classes design/modelling approach when writing selenium webdriver scripts using Java. Example of one modelling approach is TDD and page object. Can we integrate both? Currently, I'm learning TDD using junit, but I'm not sure if i would be able to use it when writing selenium webdriver scripts.

Thanks in advance!

6
  • Why you want to use selenium with JavaScript when you have protractor that does exactly that ?
    – PDHide
    Feb 2 '20 at 19:35
  • @PDHide Java != JavaScript.
    – jonrsharpe
    Feb 2 '20 at 19:36
  • Hi, I have used selenium webdriver/java not javascript. Feb 2 '20 at 19:44
  • Don't know much about Protractor. Feb 2 '20 at 19:45
  • @user11702680 when you put it as java scripts using selenium ,I thought you want to write selenium in JavaScript
    – PDHide
    Feb 2 '20 at 19:55
2

What's the purpose of the most advanced/the best/...? You should be more concerned about how well you test, not that much about the best/the most advanced etc. Sure, there are good and bad approaches, but I'd be careful about saying something is the best/the most advanced. How do you even recognise the best design? What are the metrics for that?

TDD stands for Test Driven Development, that roughly means you write tests first and then you develop a feature. So you should not end up with any new code that hasn't passed the tests. TDD refers to how you organise your work.

Design patters such as page object model is a general solution to some kind of problem you face in your code. In terms of the page object model, you basically create an interface that allows you, in your tests, to work with a page/part of the page/some element etc. The purpose of this pattern is not to duplicate code (well, I guess more design patterns exist because of this very reason). The bottom line is, it's how you organise your code.

Can we integrate both?

Having said all that about TDD and design patterns, I don't see a reason why you can't work in TDD style and use design patterns in your code.

1
  • Thanks puzzle. I'm not an expert of automation, trying to get into this area. Though, I used selenium webdriver/java, I couldn't got farther with proper design patterns. Feb 2 '20 at 19:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.