Thursday, 10 July 2014

Cucumber vs TestNG : Which is better?

I have been a long time user of TestNG.  Few months back, I started exploring about Cucumber. It was a wish from my client to create automation framework using Cucumber. I searched on web & found many blogs on Cucumber & its implementation. I started with assumption that Cucumber will replace TestNG. After working for few months, I came to following conclusion they are as follows -

  • Cucumber is a collaboration tool, which lets non-technical people write executable specifications. Those executable specifications test your app from the outside - like a black box.
  • Cucumber is not meant to be used as a unit testing tool.
  •  It allows to write automated acceptance tests, functional requirements and software documentation into one format that would be understandable by non-technical people as well as testing tools
  • You can implement your tests using the same language you use to discuss them with the business. 
  • Cucumber adds the overhead of plain English (or other native language) to executable code conversion
  • Good for acceptance testing

  • TestNG are unit testing tools. They are great for testing individual classes, but not great for executable specifications that are readable (and writeable) by non-technical people.
  • It facilitates to test individual classes.
  •  You can group tests using tags.
  •  TestNG supports a lot of complicated practices like priorities, grouping, listener etc. 
  •  Useful when you have to automate large number of test case