November 2018 Summaries
8 posts from Sauce Labs
Filter
Month:
Year:
Post Summaries
Back to Blog
Selenium's locator strategy can be improved by using CSS instead of XPath for better readability and maintainability. This is because CSS selectors are faster, less brittle, and easier to read. The best approach is to know both XPATH and CSS well. Simple elements like input fields can be easily located with either method, but CSS is preferred when dealing with more complex structures like child nodes or subnodes. Using the correct notation for IDs and classes in both XPATH and CSS can also make locators shorter and cleaner. Understanding these locator strategies can improve Selenium tests and make them more efficient.
Nov 28, 2018
372 words in the original blog post.
The advent of microservices architecture has led to significant changes in software testing, with a shift from monolithic testing to granular, simultaneous development and testing. Unit tests are essential for ensuring the basic functionality of individual services, while integration tests focus on communication between services and external components. Chaos engineering helps build resilient applications by inducing failures and forcing engineers to respond, but this practice should be started small and implemented with tools like Istio or Chaos Monkey. Finally, test automation is crucial for enabling successful GitOps, which automates deployments starting from a GitHub repository, and requires a keen focus on testing to maintain quality.
Nov 28, 2018
984 words in the original blog post.
The focus pseudo-class allows you to select the element that has focus, which can be useful for verifying that a specific JavaScript fired and an element has focus. This technique is preferred over using XPATH because it is easier to read, simple, and generally less brittle. The code snippet demonstrates how to use this pseudo-class in Ruby to check if no element has focus on page load and then sets the focus on the first input after sending a tab to the page, types "Hello WebDriver!" into it, and asserts that the text is present.
Nov 21, 2018
517 words in the original blog post.
Selenium can be used to take screenshots of a web page in order to check for unanticipated changes. This can be done by comparing the captured screenshot with the current screen pixel-by-pixel or by storing the screenshots away and having a human review them. Selenium provides a `save_screenshot` command that can be used to capture screenshots, which can be implemented using plain vanilla webdriver or extensions provided by partner companies like Applitools. The code for taking a screenshot in Ruby and Python is provided as an example and can be found on GitHub for further use and modification.
Nov 20, 2018
216 words in the original blog post.
You can efficiently remove cookies in Selenium tests by using the `driver.quit()` method in Firefox and Chrome, which will start a new session with lost cookies. For Internet Explorer and Edge, alternatives include shelling out to the command line to remove cookies or going into browser settings to delete cookies, although these methods may require explicit waits. Another approach is to use the registry editor to delete cookies, or create a batch file to automate this process. Additionally, renting the web browser used for testing can be an alternative solution.
Nov 16, 2018
354 words in the original blog post.
Creating a new window using Selenium WebDriver allows you to perform tasks in a shared session while dealing with popup windows. Selenium IDE provides commands such as `openWindow`, `waitForPopup`, and `selectwindow` to interact with multiple windows. However, these commands have limitations when it comes to playback testing. To overcome this, developers can use the Selenium WebDriver API to create new windows and switch between them in their preferred programming language, such as Java. The example provided uses Java and opens a new window using JavaScript to redirect to a search page, then switches between two windows and asserts the titles of each page. This approach allows for more flexibility and control over the testing process.
Nov 11, 2018
364 words in the original blog post.
The role of a test engineer is crucial in the development lifecycle, as they design and implement testing strategies for applications. To be effective, a test engineer needs to possess skills such as being detail-oriented and logical, having strong communication skills, familiarity with automated testing frameworks like Selenium or Espresso, and a strong understanding of CI/CD concepts. Additionally, developing with a testing mindset is essential, which involves writing testable and reusable code, adding automated tests for feature acceptance, and integrating continuous integration and delivery processes. With the increasing speed of software delivery, having skills in software testing frameworks, DevOps, and automation can prove valuable for any test engineer to design and implement effective application tests.
Nov 06, 2018
862 words in the original blog post.
While maintaining software test scripts is often seen as a chore, it doesn't have to be. To make the process faster and less tedious, developers should own quality and take control of testing, setting standards and using design patterns to improve automated testing. This includes reducing code duplication by following the page object model, defining clear waiting strategies, and locator strategies such as unique IDs. It's also essential to focus on automating the right things, not everything, and minimize UI tests. By recognizing common flavor characteristics that cause unreliability of test scripts, such as unstable environments or poorly written scripts, developers can build a culture where quality is a team effort and reduce test script maintenance. By following best practices and learning from mistakes, developers can make the testing process more efficient and effective.
Nov 01, 2018
1,195 words in the original blog post.