Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Am a beginner in Selenium and am trying to learn selenium on my own by googling. One thing which I noticed was in many of the posts which I read about selenium the name of the framework by name "TestNG" is common. I have understood that its a framework and with its Annotations and Test case compliance power, we can organise our Selenium test cases using the TestNG. But I have few queries regarding the same:

  1. By using the TestNG framework, should we modify the Selenium Code which we write?
  2. Are there any Coding standards which has to be mandatorily used while using TestNG? Please, do clarify my doubts. And even reccomend some of the blogs/sites from where I can learn Selenium as a begginer.

Thanks a ton in Advance!!

share|improve this question
    
TestNG is a test execution engine - the part that identifies methods as test cases and executes them, similar to the other ones MichaelF mentioned below. Other common ones are all of the xUnit frameworks, so JUnit is another common one for code written in Java. –  Sam Woods Apr 22 at 0:09

2 Answers 2

up vote 5 down vote accepted

I have used Selenium and TestNG in the past to manage a lot of my automation and as Siva mentioned you do have the basics down. While TestNG is one of the most common Frameworks out there, it is not the only one, and you can use whatever one works for you. So long as you can import the Selenium drivers you can use any framework in which you are familiar, I've used Gallio, TestNG, PowerShell, Fitnesse/Fitnium as a wrapper and even Python/Robot to drive the tests. Find which one works for you.

Look for a way to organize your tests that make sense to you and your Users, I have added SpecFlow on top of my Test Cases to make the higher level descriptions more readable to Business Users. This allowed me to code with Selenium/Web Driver behind the scenes and do the kind of testing I wanted, while presenting a readable set of Test Cases to my Users.

As to your questions:

  1. You should not need to modify your code while using TestNG, although it depends on what features of TestNG you take advantage of; you probably could though I didn't when I originally set up my framework.
  2. Coding Standards I tend to think of as being specific to your company, if you don't already have some standards then check with your developers and see if you can co-opt theirs this way you have a standard across departments. Code then looks the same in your organization and it is easy for anyone to review, or even give your test code a code review - which you should do anyway.

There are plenty of places to learn, but it depends on your level of expertise. Check the examples at the Selenium site first, then if you feel comfortable you can look for more.

share|improve this answer

You seem to have picked up basics correctly. I can add my inputs

Selenium is mainly for web test automation. Predominantly you will simulate user actions on the website. The code generated by IDE need to be modified to make it data driven / organizing test scenarios etc

If you are going to write automation code (you need to manage input data handling, pre-test execution, post test execution, tracking errors / failures etc). TestNG framework provides all the above listed features by itself reducing your effort to reinvent the wheel.

Refer basic examples from testng.org, seleniumtests.com.

This forum can provide lot more useful pointers / specific help if you run into issues.

share|improve this answer
1  
Thanks a lot for the Answer :) –  Pratibha Apr 21 at 18:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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