If you don't have selenium IDE, Go here.
Two major features of Selenium IDE are record and play. Selenium starts recording if the red button on the right hand corner is on. Script is divided into three different parts: Command, Target and Value. Selenium has three types of commands; Actions, Accessors and Assertions. Actions are the actions such as click or type. Accessors test the state of the applications and store the results in variables. Assertions are used to compare the actual result with the expected result. They
have 'verify' 'assert' and 'waitFor' prefix. During recording user can
simply right click and add these assertion for verification purpose or
can be added later on.'waitFor'
command waits until some condition is true. They do not wait if
targeted condition is met but wait for some time if something is in
progress.
Common Selenium commands recorded by IDE are: open, type, click, click.., select, ...AndWait suffix eg clickAndWait, addSelection and etc.
What is the difference between verify and assert? when to use what?
When assert fails, current test script stops running and test in progress jumps to another test script. When verify fails, it logs the error but same script keeps running. So when to use what is your choice. But you can always borrow some idea from best practice.
If you are verifying many elements is present in a page, you can 'assert' the title of the page to make sure you are in the right page. If you are in the wrong page, its OK even script stops running right?
Assert is best used for critical part of the application, such as log-in verification. Once you are logged in with an username you can assert that particular used name is there.
Selenium IDE is widely used to record the script and export into other programming languages such as Java, C#, Python and Ruby. You export script to your desired environment/framework such as Junit, TestNG and run your test from there. If you wish to run with TestRunner, you can save your script as a .html file and run it. Please go here to learn more about it.
Selenium IDE is widely used to record the script and export into other programming languages such as Java, C#, Python and Ruby. You export script to your desired environment/framework such as Junit, TestNG and run your test from there. If you wish to run with TestRunner, you can save your script as a .html file and run it. Please go here to learn more about it.
No comments:
Post a Comment