Google+

Different Unit Testing Frameworks supported by Selenium

Selenium supports a huge list of Unit Testing Frameworks, based on the programming languages. i.e. Different programming languages will be compatible with different Unit Testing Frameworks.

Example: TestNG unit testing framework is compatible with Java programming language and NUnit unit testing framework is compatible with C# programming language.




urpose of Unit Testing Frameworks in Selenium:

Before understanding how Unit Testing Frameworks are used in Selenium, we have to understand that Unit testing is generally done by developers. i.e. Developer break the complete application code into smaller units and test all the units separately. This process of breaking the code into smaller units and testing is known as Unit Testing. Unit Testing can be performed in both manual and by automation.

In order to automate this unit testing process, developer use different Unit Testing Frameworks based on the programming languages they have used. i.e. While the developer continue developing the application code by simultaneously creating unit test for the developed code, the existing unit tests will be automatically run by the Unit Testing Framework on the earlier developed code, to check the newly developed code is not breaking the earlier developed code. As this is done automatically by the Unit Testing frameworks, developers dont have to waste their time in manually testing the units tests on earlier written code, each time they develop new code. Though there are many other advantages of automating the unit testing process using the Unit Testing Framework, the one that I explained in this para is the main purpose of automating the Unit Testing process.

Now, lets understand the purpose of Unit Testing Frameworks in Selenium:

Unit Testing Frameworks play a major role in developing different types of Test Automation Frameworks in Selenium.

Unit Testing Frameworks can be used in Selenium to automate/support/perform any of the below:

  • Controls the flow of test case execution
  • Grouping the test cases in to separate groups is possible
  • Prioritizing the test cases is possible to prioritize which test needs to be executed first and which next.
  • Parameterizing the tests in such a way that the same tests can run multiple times using the different sets of data
  • Supports reading the data from the external sources like Excel files etc. 
  • Parallel execution of tests to save time of test execution by executing multiple tests at the same time
  • Supports generating text logs to later find-out what are the different things that happened while the tests were executing
  • Supports generating reports to find out the test results after tests execution

The below diagram, depicts the purpose of  Unit Testing Frameworks in Selenium:




Unit Testing Frameworks that are supported by Selenium:

As we have understood the purpose of using Unit Testing Frameworks in Selenium Automation, now lets find out the different unit testing frameworks that are supported by Selenium based on different programming languages.

Programming languages and their compatible Unit Testing Frameworks:

The below are the different Unit Testing frameworks that are supported by Selenium and categorized according to their compatible Programming languages.

  • Java : TestNG and JUnit Unit Testing Frameworks
  • C# : NUnit and Haskell Unit Testing Frameworks
  • PHP: (Behat+Mink) Unit Testing Frameworks
  • Python : unittest , pyunit , py.test and robot framework Unit Testing Frameworks
  • Ruby : RSpec and Test::Unit Unit Testing Frameworks

The below diagram depicts the above categorization of Unit Testing frameworks according to different programming languages:



Conclusion:

Hence there are different Unit Testing Frameworks supported by Selenium based on the programming languages. And these Unit Testing Frameworks play an important role in building Test Automation Frameworks in Selenium.

No comments:

Blog Index