In this post i will try to explain you about the selenium automation framework using testng.
To build this framework you need following things.
I will explain you the brief explanation of above components in automation framework. This automation framework is the data driver framework because we are keeping data which is input to the automation into mysql database . In later i will explain how the data will driver the execution. We will use basic annotations of testng like @beforetest,@beforesuit,@test ,@aftersuite in framework to do the particular task . @beforetest annoted method gets executed before executing the suite (suite is nothing but a set of test nodes which contains methods,test classes ...),@beforetest annoted methods gets executed before test node of suite ,@aftersuite annoted method gets executed after suite execution. @test annotation will be used to mark method as testng test method , in which we write the actual code for automation. It will support parallel execution of the tests.
To provide the data to the @test method we will use dataprovider from testng. There are two types of data provider one is which returns two dimension object of an array, other one is lazy iterator. So we will use lazy data provider . The difference between these two providers is first one which returns object[][] sends data to the @test annoted method in one pass ,where as lazy data provider sends data one by one , i mean lazy provider sends one set of data to the @test method and waits for its execution completion and sends next set of data. I have implemented this DataProvider as an inner class which implements Iterator<Object[]> interface.
reportng.jar will be used to generate and html report, This will be used as a third part open source report generator. So use you have to mark this as a listener in your suite xml or in your build.xml
Eclipse this will be used as an IDE for java development.
Mysql this will be used to store automation related stuffs into the database.
Please find attached sample code and please let me know if you have any concerns.
To build this framework you need following things.
I will explain you the brief explanation of above components in automation framework. This automation framework is the data driver framework because we are keeping data which is input to the automation into mysql database . In later i will explain how the data will driver the execution. We will use basic annotations of testng like @beforetest,@beforesuit,@test ,@aftersuite in framework to do the particular task . @beforetest annoted method gets executed before executing the suite (suite is nothing but a set of test nodes which contains methods,test classes ...),@beforetest annoted methods gets executed before test node of suite ,@aftersuite annoted method gets executed after suite execution. @test annotation will be used to mark method as testng test method , in which we write the actual code for automation. It will support parallel execution of the tests.
To provide the data to the @test method we will use dataprovider from testng. There are two types of data provider one is which returns two dimension object of an array, other one is lazy iterator. So we will use lazy data provider . The difference between these two providers is first one which returns object[][] sends data to the @test annoted method in one pass ,where as lazy data provider sends data one by one , i mean lazy provider sends one set of data to the @test method and waits for its execution completion and sends next set of data. I have implemented this DataProvider as an inner class which implements Iterator<Object[]> interface.
reportng.jar will be used to generate and html report, This will be used as a third part open source report generator. So use you have to mark this as a listener in your suite xml or in your build.xml
Eclipse this will be used as an IDE for java development.
Mysql this will be used to store automation related stuffs into the database.
Please find attached sample code and please let me know if you have any concerns.
No comments:
Post a Comment