There are two types of HTML tables published on the web- Static tables : Data is static i.e. Number of rows and columns are fixed. Dynamic tables : Data is dynamic i.e. Number of rows and columns are NOT fixed.Handling static table is easy, but dynamic table is a little bit difficult as rows and columns are not constant. Using X-Path to Locate Web Table Elements Before we locate web element, first let's understands- What is a web element? Web elements are nothing but HTML elements like textbox, dropdowns radio buttons, submit buttons, etc. These HTML elements are written with start tag and ends with an end tag. For Example, <p> My First HTML Document </p>. Steps for getting X-path of web element that we want to locate. Step 1) In Chrome, Go to http://money.rediff.com/gainers/bsc/daily/groupa Step 2) Right click on web element whose x-path is to be fetched. In our case, right click on "Company" Se...
In a Selenium TestNG project, we use testng.xml file to configure the complete test suite in a single file. Some of the features are as follows. testng.xml file allows to include or exclude the execution of test methods and test groups It allows to pass parameters to the test cases Allows to add group dependencies Allows to add priorities to the test cases Allows to configure parallel execution of test cases Allows to parameterize the test cases 7. How to pass parameter through testng.xml file to a test case? We could define the parameters in the testng.xml file and then reference those parameters in the source files. Create a java test class, say, ParameterizedTest. java and add a test method say parameterizedTest() to the test class. This method takes a string as input parameter. Add the annotation @Parameters(“browser”) to this method. 1 2 3 4 5 6 7 8 9 10 11 12 // ...
How to run a group of test cases using TestNG? TestNG allows you to perform sophisticated groupings of test methods. Not only can you declare that methods belong to groups, but you can also specify groups that contain other groups. Then TestNG can be invoked and asked to include a certain set of groups (or regular expressions) while excluding another set. This gives you maximum flexibility in how you partition your tests and doesn’t require you to recompile anything if you want to run two different sets of tests back to back. Groups are specified in your testng.xml file and can be found either under the <test> or <suite> tag. Groups specified in the <suite> tag apply to all the <test> tags underneath. @Test (groups = { "smokeTest", "functionalTest" }) public void loginTest(){ System.out.println("Logged in successfully"); } How to create Group of Groups in TestNG? Groups can also inc...
Comments
Post a Comment