March 2021 Summaries
24 posts from TestMu AI
Filter
Month:
Year:
Post Summaries
Back to Blog
The webinar on the mobile-first approach and testing highlighted the growing importance of designing websites for mobile devices first, given the increasing reliance on smartphones for internet access. Hosted by LambdaTest and Applitools, the session explored the benefits of a mobile-first strategy, emphasizing its role in enhancing user engagement and retention. Anand Bagmar from Applitools discussed the challenges and considerations of adopting a mobile-first approach, such as understanding the target audience, choosing between native and mobile web apps, and the complexities of mobile testing compared to desktop testing. He introduced the concept of the mobile testing pyramid and demonstrated Applitools' Visual AI for integrating functional and visual testing. Mudit Singh from LambdaTest underscored the importance of mobile web apps and explained how LambdaTest supports mobile web testing with its cloud-based device lab. The event concluded with a Q&A session, offering insights into mobile-first strategies and testing practices.
Mar 30, 2021
1,577 words in the original blog post.
Dynamic web pages, which change content based on user interactions, require specialized tools for data extraction, and Selenium is a preferred choice for scraping such pages due to its ability to handle JavaScript-generated content. The blog post discusses using Selenium with C# for scraping data from dynamic web pages, emphasizing the difference from static page scraping, which can be done with tools like HTMLAgilityPack. It provides a step-by-step guide on setting up a Selenium C# project in Visual Studio, including necessary packages and browser drivers, and demonstrates scraping examples on LambdaTest's YouTube channel and blog page. These examples showcase Selenium's ability to mimic user actions and extract data like video titles, views, upload times, and blog metadata. The post also highlights the importance of understanding a website's structure and using Selenium's FindElements and FindElement methods to locate and extract data effectively.
Mar 29, 2021
3,804 words in the original blog post.
Automation testing with Selenium PHP faces challenges due to dynamically loaded web elements through AJAX and JavaScript, which can lead to synchronization issues. Selenium WebDriver does not track the real-time state of the Document Object Model (DOM), making it susceptible to exceptions like 'element not clickable'. To address these issues, Selenium offers implicit and explicit wait commands to synchronize timing in web automation. Implicit wait sets a global delay for the WebDriver to poll the DOM, while explicit wait halts execution until a specific condition is met. Explicit wait is more versatile, allowing for conditions such as visibility or clickability of elements, and is preferred for managing synchronization between the browser and the Selenium script. Implicit wait is simpler but less reliable, as it applies globally and may not handle complex scenarios efficiently. Overall, synchronization in Selenium is crucial for robust test automation, and explicit wait is recommended over implicit wait due to its precision and flexibility.
Mar 26, 2021
4,204 words in the original blog post.
The article by Bharadwaj Pendyala provides a comprehensive guide on setting up a Continuous Integration/Continuous Deployment (CI/CD) pipeline using Travis CI, a cloud-based service that automates builds and tests for projects hosted on GitHub. It explains the benefits of using Travis CI, including its seamless integration with GitHub, support for various programming languages and platforms, and its ability to automate cross-browser testing through services like LambdaTest. The article details the steps to configure Travis CI, emphasizing the importance of the .travis.yml configuration file, which dictates the build process. It also highlights Travis CI's advantages, such as automatic build triggers and detailed documentation, while noting challenges like limitations in integration beyond GitHub. Additionally, the text discusses how to integrate automated testing with LambdaTest for enhanced cross-browser testing capabilities, underscoring the importance of automation in maintaining software quality and reducing manual testing dependencies.
Mar 24, 2021
2,019 words in the original blog post.
The article explores various strategies for handling login pop-ups in Selenium WebDriver using Java, focusing on authentication pop-ups that require user credentials to access certain websites. It outlines multiple methods, including passing credentials directly in the URL, using AutoIT scripts, and leveraging new features in Selenium 4 like the ChromiumDriver class, which facilitates the use of Chrome DevTools for setting basic authentication through additional HTTP headers. The text also discusses executing these tests on LambdaTest's cloud platform, which supports extensive cross-browser testing, and highlights how to monitor and analyze test results using LambdaTest's dashboard and video recordings. The article aims to equip readers with practical techniques for automating test scripts to efficiently handle login pop-ups, enhancing their test automation capabilities.
Mar 23, 2021
1,359 words in the original blog post.
Choosing the right unit testing framework for .NET Core projects can be challenging, with MSTest, NUnit, and xUnit.Net being the three primary options. Each framework uses attributes to define test methods and execution flow, but they differ significantly in their approach to test isolation, extensibility, initialization, and parallel test execution. NUnit, popular for its ease of use and wide platform support, is often chosen for Test-Driven Development (TDD) in C#. xUnit, created by the original authors of NUnit to address its limitations, emphasizes test isolation and extensibility, making it a robust choice for Selenium automation testing. MSTest, integrated with Visual Studio and now open-source, offers a straightforward approach with features like parallel test execution at both method and class levels. Each framework has its strengths, with xUnit standing out for its community-driven improvements and extensibility, making it suitable for projects requiring clean, maintainable test code.
Mar 22, 2021
4,316 words in the original blog post.
The tutorial explores parameterization in the Pytest framework with Selenium, emphasizing its role in enhancing test efficiency by allowing multiple test scenarios with varied input values. It outlines the use of parameterized tests to eliminate code duplication and boost test coverage, detailing several methods: using `pytest.fixture()` for fixture functions, `@pytest.mark.parametrize` for test function arguments, and `pytest_generate_tests` for custom schemes. The guide also delves into fixture scope and lifetime, the advantages of modular fixture implementation, and using dependency injection in Pytest. Further, it discusses cross-browser testing using LambdaTest, an online platform for testing across various browsers and operating systems. The tutorial provides comprehensive insights into Pytest APIs like `pytest.fail`, `pytest.xfail`, `pytest.skip`, and `pytest.raises`, highlighting their utility in handling different test scenarios. The tutorial concludes with practical examples of using these tools for cross-browser testing automation, offering guidance on setting up tests on LambdaTest's Selenium Grid and leveraging command-line options for customized test executions.
Mar 20, 2021
6,336 words in the original blog post.
Jenkins Freestyle Projects offer a flexible and configurable way to create build jobs for various tasks such as compiling code, running tests, or deploying applications. These projects are highly adaptable, allowing developers to script actions and integrate with various plugins like Git, Maven, and SonarQube. Despite their power, managing Freestyle jobs can be cumbersome, prompting a shift towards Declarative Pipelines which provide a more structured and modern approach. Creating a Freestyle project involves setting up Jenkins, configuring project details, and integrating source code management and build steps. Additionally, there are methods to convert Freestyle projects into Declarative Pipelines using tools like the Declarative Pipeline Migration Assistant, which automates parts of the transition process. This conversion is beneficial for maintaining a more robust and manageable CI/CD pipeline. Through the use of plugins and scripts, Jenkins Freestyle Projects can be extended to handle complex build tasks, including building Docker container images and scanning serverless functions for vulnerabilities.
Mar 19, 2021
4,241 words in the original blog post.
The tutorial explores the use of xUnit parameterized tests for optimizing Selenium test code by reducing duplication and enhancing code reusability. It highlights how the xUnit framework in C# supports both parameterized and non-parameterized tests, using the Theory attribute to facilitate data-driven testing through attributes like InlineData, ClassData, and MemberData. The tutorial uses LambdaTest, a cloud-based cross-browser testing platform, to demonstrate executing parameterized tests on various browser and operating system combinations, emphasizing the benefits of scalability, parallel execution, and improved test coverage. The guide also discusses the nuances of using InlineData for simple constants, while MemberData and ClassData are recommended for more complex scenarios, illustrating how these approaches can efficiently handle numerous test scenarios in cross-browser testing.
Mar 18, 2021
2,265 words in the original blog post.
The CSS aspect-ratio property is a recent addition to web development that simplifies the management of element dimensions on web pages, crucial for creating responsive designs. It allows developers to set a specific width-to-height ratio for elements, which automatically adjusts their size across various devices, enhancing user experience. This property is particularly useful for handling images, videos, and grid layouts, as it prevents unwanted visual distortions when elements resize. While browser support for aspect-ratio is still developing, alternatives such as manual calculations and the CSS object-fit property can be used to achieve similar responsiveness. The post emphasizes experimenting with aspect-ratio for flexible designs, while also considering image quality and browser compatibility. Despite current limitations, the aspect-ratio property is expected to become more widely supported as demand for responsive web design grows.
Mar 16, 2021
2,856 words in the original blog post.
The article delves into the integration of Selenium tests within Docker environments, highlighting the advantages of using Docker for automation testing and continuous integration. Docker, an open-source containerization platform, enables the isolation and efficient execution of Selenium tests, thereby accelerating test automation and ensuring high code quality. The text discusses Docker's ability to run applications securely in containers, contrasting it with virtual machines and emphasizing its lightweight nature due to the absence of a guest operating system. It explains setting up Docker on Windows and the benefits of using Selenium with Docker, such as scalability, less installation overhead, and improved security. The document further explores running Selenium in a standalone container and a grid of containers, detailing steps like pulling Docker images, configuring the RemoteWebDriver, and utilizing Docker Compose for managing multi-container applications. Additionally, the article introduces Zalenium, an open-source Docker-based Selenium Grid that enhances Selenium's capabilities by integrating with cloud-based services like LambdaTest, allowing for scalable, cross-browser testing with features such as video recording and live previews.
Mar 15, 2021
7,140 words in the original blog post.
The Selenium MSTest tutorial provides a detailed guide on setting up Selenium WebDriver for automated testing with the MSTest framework in C#. The process begins by creating a new MSTest Test Project in Visual Studio, followed by installing Selenium WebDriver through the NuGet Package Manager. Users can choose between using the Visual Studio IDE or executing commands in the Package Manager Console to complete the installation. The tutorial emphasizes the use of the Chrome browser for testing and provides essential steps to verify the installation of necessary packages. It serves as a comprehensive resource for beginners and professionals to perform cross-browser testing with Selenium, MSTest, and C#. Additionally, the tutorial briefly compares MSTest with NUnit, highlighting MSTest's advantages in speed and robustness due to its parallel execution of tests.
Mar 14, 2021
861 words in the original blog post.
Creating an intuitive mobile user experience (UX) is crucial for businesses aiming to reduce customer churn and enhance engagement, as a significant number of online shoppers are unlikely to return to a website after a poor experience. Given the widespread use of mobile devices, a mobile UX serves as a brand's first impression and should be carefully crafted to include elements such as speed, navigation, reachability, usability, responsiveness, visual appeal, and personalization. Progressive Web Apps (PWAs) are highlighted as an effective strategy for increasing user engagement, as they offer a mobile-optimized experience without the need for app downloads. The text emphasizes the importance of responsive design, minimalism, and cross-browser compatibility to ensure a seamless user journey. Additionally, it suggests leveraging tools like the LT Browser for testing and debugging mobile websites, ultimately aiming to transition from a good user experience to an exceptional one.
Mar 12, 2021
1,690 words in the original blog post.
The Page Object Model (POM) in Selenium Python is a design pattern that enhances the maintainability and modularity of automation test codes by creating a structured object repository for web elements. This approach separates web element locators from test scripts, allowing minimal changes in the test scenarios when the UI changes. The POM pattern reduces code duplication and increases the reusability and readability of test scripts, making it easier to manage complex test scenarios across various web pages. It integrates well with different test frameworks, allowing flexibility in testing approaches. The article illustrates the implementation of POM through examples using Google Search and LambdaTest, emphasizing the ease of code maintenance and the benefits of using cloud-based platforms like LambdaTest for automated cross-browser testing. The POM framework is recommended for test and development teams to explore, especially for projects with frequent UI updates, as it supports efficient and scalable test automation solutions.
Mar 11, 2021
2,854 words in the original blog post.
The article provides an in-depth guide on using GitLab CI to run tests locally, emphasizing its advantages over traditional methods like Jenkins. GitLab CI is a continuous integration/continuous delivery (CI/CD) server that automates code testing with scripts triggered by code pushes to a repository, ensuring any changes meet predefined standards. The text highlights the challenges of local testing, such as limited browser and operating system coverage, and how GitLab CI's features, like multi-platform support and autoscaling, address these issues. By utilizing Docker and the GitLab Runner, developers can replicate CI environments locally to troubleshoot and optimize code before deploying. The article also introduces the LambdaTest Tunnel for further testing capabilities across various browser environments, ensuring cross-platform compatibility. It concludes by encouraging the integration of Selenium test suites with GitLab CI via LambdaTest for a robust automated testing pipeline, ultimately providing developers with the confidence needed for successful production deployments.
Mar 10, 2021
3,234 words in the original blog post.
JavaScript design patterns are established solutions for common software design issues, enhancing code reuse and maintainability. These patterns, rooted in object-oriented principles, were formalized in 1994 by the "Gang of Four" and have since evolved, including Creational, Structural, and Behavioral categories, each with specific roles in object creation, composition, and interaction. The blog explains popular JavaScript design patterns like Singleton, Factory, Module, and Observer, offering a structured approach to coding. It also touches on Anti-Patterns, which are poor coding practices, and suggests using the LambdaTest platform for cross-browser testing to ensure pattern implementation consistency. The blog concludes by recommending resources like Addy Osmani’s "Learn JavaScript Design Patterns" for deeper understanding.
Mar 09, 2021
7,017 words in the original blog post.
In this tutorial, we will learn how to handle dropdowns in Selenium WebDriver using Python. We will explore different methods to select or deselect options from a dropdown and also discuss ways to handle multiple selections if allowed by the dropdown. Additionally, we will cover scenarios where an element is not interactable due to its invisibility or being obscured by another element.
To get started with this tutorial, you should have basic knowledge of Python programming language and Selenium WebDriver. You can refer to our previous tutorials on Introduction to Selenium WebDriver and Installing Selenium WebDriver in Python for more information.
Let's begin!
## Handling Dropdowns Using Select Class
Selenium provides a built-in class named `Select` under the module `selenium.webdriver.support.ui`. This class is specifically designed to handle HTML SELECT tags, which are commonly used for creating dropdown menus in web applications.
The `Select` class offers several methods that can be used to interact with a dropdown element:
- `select_by_visible_text(value)` : Selects an option from the dropdown by its visible text.
- `select_by_value(value)` : Selects an option from the dropdown by its value attribute.
- `select_by_index(index)` : Selects an option from the dropdown by its index position.
- `deselect_all()` : Deselects all selected options in a multi-select dropdown.
- `deselect_by_visible_text(value)` : Deselects an option from the dropdown by its visible text.
- `deselect_by_value(value)` : Deselects an option from the dropdown by its value attribute.
- `deselect_by_index(index)` : Deselects an option from the dropdown by its index position.
- `get_options()` : Returns a list of all options in the dropdown.
- `get_all_selected_options()` : Returns a list of all currently selected options in the dropdown.
Let's see how we can use these methods to interact with a dropdown element on a webpage.
### Example 1: Selecting an Option from Dropdown
Consider the following HTML code snippet that contains a simple dropdown menu:
```html
<select id="lang" name="lang">
<option value="java">Java</option>
<option value="python">Python</option>
<option value="csharp">C#</option>
<option value="ruby">Ruby</option>
<option value="javascript">JavaScript</option>
</select>
```
We can use the `Select` class to interact with this dropdown as follows:
```python
from selenium import webdriver
from selenium.webdriver.support.ui import Select
# initialize a new instance of Chrome browser and open the target url
driver = webdriver.Chrome()
# navigate to the URL containing the dropdown
driver.get('https://pynishant.github.io/dropdown-selenium-python-select.html')
# identify the select element with id="lang" using Selectors and select an option from it by its visible text
dropdown = driver.find_element_by_id('lang')
# creating a selenium Select webelement of html <select> tag
selectElement = Select(driver.find_element_by_id('lang'))
# using selenium webdriver's select class methods to find an option with visible text "Python" and selecting it
selectElement.select_by_visible_text('Python')
# print the selected value of dropdown
print("Selected option from dropdown : "+selectElement.first_selected_option.get_attribute('innerText'))
}
```
In this example, we first locate the `<select>` element using its ID attribute and then create a Selenium Select web element object for it. After that, we use the `select_by_visible_text()` method of the Select class to select an option from the dropdown by its visible text ("Python"). Finally, we print out the selected value of the dropdown using the `first_selected_option` property of the Select class.
### Example 2: Deselecting All Selected Options in a Multi-Select Dropdown
Consider the following HTML code snippet that contains a multi-select dropdown menu:
```html
<select id="lang2" name="lang2" multiple>
<option value="java">Java</option>
<option value="python">Python</option>
<option value="csharp">C#</option>
<option value="ruby">Ruby</option>
<option value="javascript">JavaScript</option>
</select>
```
We can use the `Select` class to interact with this multi-select dropdown as follows:
```python
from selenium import webdriver
from selenium.webdriver.support.ui import Select
# initialize a new instance of Chrome browser and open the target url
driver = webdriver.Chrome()
# navigate to the URL containing the dropdown
driver.get('https://pynishant.github.io/dropdown-selenium-python-select.html');
# identify the select element with id="lang2" using Selectors and check if attribute "multiple" is present in it.
dropdown = driver.find_element_by_id('lang2')
if dropdown.get_attribute("multiple"):
# xpath selector to find the element with text "C#" and "PHP" respectively
myOption = driver.find_element_by_xpath("//select[@multiple]/option[contains(text(), 'C#')]")
myOption1 = driver.find_element_by_xpath("//select[@multiple]/option[contains(text(), 'PHP')]")
# using actionchains to select multiple options
ActionChains(driver).key_down(Keys.CONTROL).click(myOption).key_up(Keys.CONTROL).perform()
# pausing program execution for few seconds
time.sleep(2)
ActionChains(driver).key_down(Keys.CONTROL).click(myOption1).key_up(Keys.CONTROL).perform()
try:
# creating a selenium Select webelement of html <select> tag
dropdown = Select(driver.find_element_by_id('lang2'))
# using selenium webdriver's select class methods to find all selected options and printing it's text. Ideally, here output should be "PHP, C#"
print("All selected options using ActionChains : \n")
for opt in dropdown.all_selected_options:
print(opt.get_attribute('innerText'))
# clearing the php selection we performed in last step
dropdown.deselect_by_visible_text('PHP')
# Again printing the active selections, this time output should be only c#
print("Remaining selected options after deselecting PHP : \n")
for opt in dropdown.all_selected_options:
print(opt.get_attribute('innerText'))
time.sleep(2)
# Using selenium select class method to deselect all options
dropdown.deselect_all()
time.sleep(2)
# Using different select class methods, to select multiple options
# selecting by index, Java
dropdown.select_by_index(3)
time.sleep(2)
# selecting by value - php
dropdown.select_by_value('php')
time.sleep(2)
# selecting by text - python
dropdown.select_by_visible_text('Python')
# printing active selections - output should include all three php, python, java
print("All selected options after selecting using different select class methods : \n")
for opt in dropdown.all_selected_options:
print(opt.get_attribute('innerText'))
dropdown.deselect_all()
# to select all possible options
dropdown = Select(driver.find_element_by_id('lang2'))
for opt in dropdown.options:
dropdown.select_by_visible_text(opt.get_attribute("innerText"))
# all four selected options should be output
print("Selected option lists after selecting all of them : \n")
for opt in dropdown.all_selected_options:
print(opt.get_attribute('innerText'))
driver.quit()
except Exception as e:
print(e)
print("error")
else:
print("get_attribute didn't work!")
```
In this example, we first locate the `<select>` element using its ID attribute and then create a Selenium Select web element object for it. After that, we use the `key_down()`, `click()`, and `key_up()` methods of the ActionChains class to simulate pressing and releasing the CTRL key while clicking on multiple options in the dropdown. Then, we use different select class methods (`select_by_index()`, `select_by_value()`, and `select_by_visible_text()`) to select multiple options from the dropdown. Finally, we print out all currently selected options using the `all_selected_options` property of the Select class.
### Example 3: Handling Dropdowns with Invisible or Obscured Options
Sometimes, you may encounter situations where an option in a dropdown is not visible or clickable due to some other element obscuring it. In such cases, you can use JavaScript executor feature of Selenium WebDriver to make the invisible/obscured option visible and clickable before interacting with it.
Here's how you can do this:
```python
from selenium import webdriver
# initialize a new instance of Chrome browser and open the target url
driver = webdriver.Chrome()
# navigate to the URL containing the dropdown
driver.get('https://pynishant.github.io/dropdown-visibility-demo.html')
# identify the select element with id="lang1" using Selectors and try clicking invisible element
langDropdown = driver.find_element_by_xpath('//select[@id="lang1"]')
ActionChains(driver).click(langDropdown).perform()
except Exception as e:
print(e)
pass
# identify the select element with id="lang" using Selectors and try clicking visible element
myOption = driver.find_element_by_xpath('//select[@id="lang"]/option[@value="python"]')
ActionChains(driver).click(myOption).perform()
# Get the selected value of element under target and element hovering target
selectedOption = Select(driver.find_element_by_xpath('//select[@id="lang"]'))
try:
selected_option = selectedOption.first_selected_option.text
except Exception as e:
print(e)
selected_option = "None"
# Get the selected value of element under target and element hovering target
selectedOption1 = driver.find_element_by_xpath('//select[@id="lang1"]/following-sibling::div[1]').text
try:
selected_option1 = selectedOption1.get_attribute("innerText")
except Exception as e:
print(e)
selected_option1 = "None"
# Print the selected values
print("Selected option from dropdown : "+selected_option)
print("Selected value of element under target and element hovering target : "+selected_option1)
```
In this example, we first locate the `<select>` element using its ID attribute and then create a Selenium Select web element object for it. After that, we try clicking on an invisible option in another dropdown menu (which is obscured by another element) using the ActionChains class. If this operation fails due to invisibilityerrorhandling dropdowns in your web application project tasks test automation cloud testing tools tools tools happy testing!!!?
Mar 08, 2021
3,437 words in the original blog post.
This tutorial provides a step-by-step guide to setting up the Selenium WebDriver for xUnit framework in C#. It begins with creating a new project in Visual Studio and then proceeds to installing Selenium WebDriver using either the Visual Studio IDE or Package Manager (PM) Commands. The tutorial also covers how to verify successful installation of packages using the Get-Package command. Finally, it emphasizes the importance of understanding essential terminologies like Selenium WebDriver and Package Manager for enhancing automation testing skills with C# and xUnit.
Mar 07, 2021
791 words in the original blog post.
In this tutorial, we will learn about MSTest framework – the default test framework that comes along with Visual Studio. We will also explore how to use MSTest for cross-browser testing and parallel execution of tests on a remote selenium grid using LambdaTest cloud platform.
The topics covered in this tutorial are:
1. Introduction to MSTest V2
2. Installing MSTest V2
3. Creating an MSTest test project
4. Local Testing using MSTest
5. Parallel Testing using MSTest
6. Cross Browser Testing using MSTest on the Cloud
Let’s dive in!
1. Introduction to MSTest V2
Microsoft's unit testing framework, also known as MSTest, is a built-in feature of Visual Studio.
MSTest V2 supports parallel execution of tests and has cross-platform support.
The advantages of using MSTest are:
a) It’s free to use with Visual studio
b) Provides rich set of attributes for defining the behavior of the test
c) Supports data-driven testing
d) Can be used in conjunction with other frameworks like NUnit and xUnit
2. Installing MSTest V2
MSTest is a part of Visual Studio, so you don’t need to install it separately.
However, if you want to use the latest version of MSTest (i.e., MSTest V2), then you can follow these steps:
a) Open Visual studio and go to Tools > Extensions and Updates
b) In the extensions window, search for ‘MSTest V2’ and install it
c) Once installed, restart your Visual studio
3. Creating an MSTest test project
To create a new MSTest test project, follow these steps:
a) Right-click on the solution in Solution Explorer
b) Choose Add > New Project > Installed > Visual C# > Test > choose MSTest Test Project (.NET Core)
c) In the Name box, enter the name and then select OK
4. Local Testing using MSTest
In this section, we will create a simple test case for testing the ‘LambdaTest Sample To-Do App’ on local selenium grid.
The test case is as follows:
a) Navigate to the to-do app https://lambdatest.github.io/sample-todo-app/
b) Mark the first two items as Done, i.e., Check those two items
c) Add a new item – Adding item to the list
d) Click the Add button to add that new item to the list
The test case is implemented using MSTest framework in C# programming language.
Below are the steps for implementing this test case:
a) Create a new class file named ‘LocalMsTest.cs’ under the newly created test project
b) Import necessary namespaces/packages, i.e., OpenQA.Selenium and OpenQA.Selenium.Interactions
c) Define a method named ‘NavigateToDoApp’, which will contain the actual test implementation
d) Use [TestClass] attribute to define this class as a Test Class, and use [TestMethod] attribute to mark the method as a Test Method
e) Inside the NavigateToDoApp method, create an instance of ChromeDriver using WebDriverInfra.Create_Browser(BrowserType.Chrome)
f) Use driver.Navigate().GoToUrl(test_url) for navigating to the test URL
g) Use driver.Manage().Window.Maximize() for maximizing the browser window
h) Locate the required web elements on the page using the Inspect Tool functionality of Chrome and perform the necessary operations
i) Assert the expected outcome using the Assert class methods
j) Finally, use driver.Quit() to close the browser window
k) Run this test case by right-clicking on the method name in Visual Studio and choosing Run Tests option
l) The Test Explorer window will show the execution status of the test
5. Parallel Testing using MSTest
Parallelism in the MSTest framework can be achieved by using the In-assembly Parallel feature of MSTest V2.
Below are the two ways in which it can be implemented:
a) Using Annotations
b) Using RunSettings
In this tutorial, we will demonstrate how to achieve parallel testing on local infrastructure using annotations. The test case implementation remains the same as demonstrated in the previous section, but with a slight modification:
a) Add [assembly: Parallelize(Workers = 2, Scope = ExecutionScope.MethodLevel)] at the top of the class file
b) This line will enable parallel execution of tests at Method Level with two threads/tests
c) Run this test case by right-clicking on the method name in Visual Studio and choosing Run Tests option
d) The Test Explorer window will show the execution status of the test, but now it will be executed in parallel
6. Cross Browser Testing using MSTest on the Cloud
Parallel testing on local infrastructure can hit a roadblock if you want to test your website/web application across ‘N’ different browsers, browser versions, operating systems, and devices.
You obviously cannot invest endlessly in setting up the test infrastructure since it is neither scalable nor economical. Not performing thorough cross-browser testing might result in a buggy experience if the customer accesses your product from an untested web browser. It reduces the overall test coverage as well.
A feasible solution is to use a cloud based cross browser testing platform like the LambdaTest, where tests are executed on a Remote Selenium Grid.
Using LambdaTest, cross browser tests can be executed on 3000+ different combinations of browsers, operating systems, and devices.
Porting the existing implementation to remote Selenium Grid requires changes in the infrastructure-related code. Once you create an account on LambdaTest, you should make a note of the user-name & access-key from Profile Section as that combination is used for accessing the remote Selenium Grid on LambdaTest.
The Automation Dashboard can be used to view all your test logs, screenshots, and video recording for your entire Selenium test.
The desired browser and platform capabilities are generated using LambdaTest capabilities Generator. For example, below are the capabilities for Safari on the macOS Mojave platform:
a) Set Capability("user", "Your Lambda Username")
b) Set Capability("accessKey", "Your Lambda Access Key")
c) Set Capability("build", "your build name")
d) Set Capability("name", "your test name")
e) Set Capability("platform", "MacOS Mojave")
f) Set Capability("browserName", "Safari")
g) Set Capability("version","12.0")
For demonstrating the usage of LambdaTest and the effectiveness of Parallel test execution on a Remote Selenium Grid, we will implement the below three test cases:
a) Test Case 1 – LamdaTest Sample To-Do App.
b) Test Case 2 & 3 – Google Search for LambdaTest.
The implementation is as follows:
a) OpenQA.Selenium.Remote package/namespace is imported as RemoteWebDriver class is defined in it.
b) The LambdaTest credentials are passed for accessing the remote Selenium Grid.
c) Browser & Device capabilities are generated using the LambdaTest capabilities generator, and the same is passed to the Remote WebDriver API.
d) The current plan on LambdaTest defines how many tests can be executed in parallel on the Remote Selenium Grid. For demo purposes, we have used 5 Parallel tests.
e) The initialization code is implemented as a part of the [TestInitialize] attribute. It will be called only once during the initialization of the tests.
f) As the browser-name, browser-version, platform-name accept input parameters as browser-name, browser-version, platform-name, and perform the necessary operations.
Results1) LT_ToDo_TestDuration: 1 min2) LT_ToDo_Test (chrome,72.0,Windows 10))Duration: 1 min3) LT_ToDo_Test (MicrosoftEdge,18.0,Windows 10))Duration: 2 sec4) LT_ToDo_Test (Firefox,70.0,macOS High Sierra))Duration: 1 min567891011213141516171819202122232425262728293031111111111111111111111111111111
Mar 06, 2021
4,517 words in the original blog post.
LambdaTest has released version 1.7.0 of its LT Browser, introducing personalized updates and a feedback board for users to share their comments, requests, and suggestions. The new 'What's New?' section keeps users updated on the latest features, updates, and fixes in LT Browser. Additionally, LT Browser now supports DevTools pinning, allowing developers to keep track of files while debugging without losing sight of them. Several issues have been fixed, including right-click problems for Mac & Windows, simultaneous DevTool windows, and website routing issues. The YouTube community is also live, offering a space for testers, developers, and the testing community to engage with each other. New browsers and devices have been added to LT Browser's real-time testing feature, supporting the latest browser versions and iOS 14.4 devices.
Mar 05, 2021
992 words in the original blog post.
With the rise of Agile and DevOps methodologies, the demand for skilled automation testers has surged, emphasizing the need for specific skills to thrive in the evolving testing landscape. Essential skills for automation testers include proficiency in programming languages like C#, Python, and Java, which are crucial for writing effective test scripts and frameworks. Additionally, strong manual testing skills remain vital, as they allow testers to identify issues that automation might miss, ensuring a comprehensive testing process. Expertise in automation tools such as Selenium, HP UFT, and Appium is also necessary to deliver high-quality applications efficiently. Understanding business requirements and development methodologies like DevOps and Agile further enhances a tester's ability to navigate complex projects. Lastly, experience with test management tools and troubleshooting abilities ensures seamless test execution and accurate results, while certifications can provide a competitive edge in the industry.
Mar 05, 2021
2,633 words in the original blog post.
This tutorial discusses handling keyboard actions in Selenium WebDriver, a tool used for automated cross-browser testing. It covers basic and advanced keyboard events such as send_keys(), key_down(), key_up(), and how to use them with the Actions class. The tutorial also provides examples of using these keyboard actions on different web pages. Additionally, it explains how to perform Selenium testing on LambdaTest's remote Selenium Grid for better results and scalability.
Mar 03, 2021
3,024 words in the original blog post.
This article discusses how to use Jenkins effectively by utilizing Jenkins Shared Library. It covers key points such as creating a Jenkinsfile, using Jenkins Shared Libraries, and running test cases on LambdaTest Cloud from Jenkins. The author also provides an example of a shared library for a Java/Spring Boot application and demonstrates how to use it in multiple projects.
Mar 02, 2021
2,799 words in the original blog post.
In this article, we discussed NUnit annotations that are used for automated browser testing using the Selenium framework. We demonstrated two test scenarios – one where local WebDriver is used and another where remote WebDriver is used along with parallel execution on LambdaTest infrastructure. The most frequently used NUnit annotations were [SetUp], [Test], [TestFixture], and [TearDown].
Mar 01, 2021
4,825 words in the original blog post.