Selenium JavaScript Home / Video /

What is Assertion in Selenium | Selenium JavaScript Tutorial | LambdaTest

What is Assertion in Selenium | Selenium JavaScript Tutorial | LambdaTest

...Playlist

...
  • Selenium JavaScript Test Automation Complete Tutorial
  • Parameterized Tests With Mocha in Selenium JavaScript
  • Headless Testing In Selenium JavaScript
  • Selenium Automation Testing On The Cloud
  • Generating Mocha Report With Mochawesome in Selenium JavaScript
  • Parallel Testing with Mocha in Selenium JavaScript
  • Getting Started with Mocha in Selenium JavaScript
  • Assertion In Selenium JavaScript
  • How To Write And Run Test Scripts in Selenium JavaScript?
  • Getting Started With Test Automation In JavaScript

About The Video

In this video, Ryan Howard (@ryantestsstuff), an engineer, explains 'assertions, their types, and their applicability in detail showcasing practically, what if the test(s) fails while performing selenium automation testing? This video answers how one can handle major errors/issues using 'Assertions'.

Video Chapters

00:00 Introduction to JavaScript Testing Tutorial for beginners

01:00 What are Assertions in Selenium JavaScript

02:05 How to use Assertions in Selenium JavaScript using Node Assertion Library

12:29 How to use Assertions in Selenium JavaScript using Chai

Key Topics Covered

Introduction to Assertions: Ryan begins by explaining what assertions are, their purpose in testing, and how they can be used to validate the state of an application. Assertions help determine if a test passes or fails based on certain conditions, such as checking if a URL has changed after a login, or if an item has been added to a shopping cart.

Writing Assertions in Node.js: The video then progresses to demonstrate how to write assertions using the built-in Node.js library. Ryan shows how to require the assertion package in a Selenium WebDriver script and writes an example assertion to validate if a specific task is added to a to-do list application.

Using Chai Assertion Library: After discussing the built-in Node.js assertions, Ryan introduces the Chai assertion library, a popular choice for writing more readable and flexible assertions in Node.js. He explains how to install Chai using npm, how to require it in your test file, and demonstrates writing assertions using Chai's "should" syntax.

Practical Example with Assertions: Throughout the video, Ryan provides a practical example where he writes a test to check if a new "to-do" item titled "Learn Selenium" is successfully added to a list. He showcases how to locate elements using XPath, retrieve text values from elements, and compare these values using both Node.js and Chai assertions to validate the test outcome.

Recap and Conclusion: The video concludes with a recap of the topics covered, emphasizing the importance of assertions in automated testing for verifying application behavior. Ryan also encourages viewers to explore more videos on the LambdaTest YouTube channel and to visit the LambdaTest blog and certification sections for further learning.

Related Blogs & Supported Docs

All You Need To Know For Selenium Testing On The Cloud

Automation Testing with Selenium JavaScript[Tutorial]

Run JavaScript Automation On Selenium Grid

GitHub repo for JavaScript Selenium Automation Testing

Ryan Howard

Ryan Howard

Ryan is an experienced Software Tester with a fervent dedication to ensuring quality in every aspect. With a wealth of experience, Ryan specializes in supporting businesses to optimize their testing processes. His focus is on streamlining operations, eliminating bottlenecks, and constructing a robust and effective testing approach tailored to the unique needs of each business. A true advocate for quality, Ryan's expertise not only enhances the testing process but also contributes to elevating the overall quality of software products.

More Videos from Selenium JavaScript