Assessments

This section contains answers to questions from all chapters.

Chapter 1, Introduction to Test Automation

  1. Testing is a process to evaluate the software application with the intent to find bugs and validate product specifications.
  2. Some of the key deliverables while doing software testing are the test plan, test strategy, test cases, test data, and automated test scripts.
  3. Test automation is the process of setting up and validating functional and non-functional specifications using a test script. This helps increase the efficiency of testing and helps deliver value to the customer quickly.
  4. Changing requirements, a lack of team collaboration, not enough planning, and a shortage of skilled resources are some of the most common challenges in the testing and test automation world.
  5. A quality analyst (manual QA), test automation engineer (skilled at manual and automated testing), and an SDET are common roles in the quality engineering space.

Chapter 2, Test Automation Strategy

  1. A test automation strategy not only aids in planning and executing the automated tests but also ensures that by and large, all efforts in test automation are placed in the right areas to deliver business value quickly and efficiently.
  2. These are some of the main objectives of test automation:
    • Strengthening product quality
    • Improving test coverage
    • Reducing manual testing
    • Increasing test portability and reducing maintenance
    • Reducing quality costs
    • Increasing stability and reliability of the product
  3. The test pyramid acts as a guideline when planning for the test coverage of a software product, and it also helps to keep in mind the scope of each test so that it remains within the designed level.
  4. Cloud-based tools enable geographically dispersed teams to scale test environments up/down at will and also help in providing on-demand capacity for non-functional tests. Testing in the cloud is one of the foundational pillars of DevOps processes.
  5. Some common advantages of using design patterns in test automation are set out here:
    • Helps with structuring code consistently
    • Improves code collaboration
    • Promotes reusability of code
    • Saves time and effort in addressing common test automation design challenges
    • Reduces code maintenance costs

Chapter 3, Common Tools and Frameworks

  1. The command-line interface (CLI) is a means to interact with the shell of the system under test. A lot of the tasks performed through the graphical user interface can be done through the CLI too. But the real might of the CLI lies in its ability to programmatically support the simulation of these tasks.
  2. Git is a modern distributed version control system that allows tracking changes to the source code. It primarily helps in synchronizing contributions to the source code by various members of the team by keeping track of progress over time.
  3. Selenium is an open source tool that provides an interface to automate user actions on web browsers. Its main components are Selenium WebDriver, Selenium Grid, and Selenium IDE.
  4. Appium is an open source tool used for automating tests on platforms such as Android and iOS. It also supports mobile browser automation with extensive community support. Appium provides libraries backing a variety of programming languages such as Java, Python, PHP, C#, JavaScript, and Ruby.
  5. Cypress primarily differs from Selenium in its in-built ability to access both frontend and backend parts of the application. This makes E2E testing its focus, while Selenium specializes in browser automation.
  6. JMeter is an open source performance testing tool that simulates user requests to a server and computes and stores the response statistics from the server.
  7. AXE comes as a browser extension that checks the web page against pre-defined accessibility rules and generates a report of compliances/violations.
  8. The criteria to be considered when selecting a test automation tool include but are not limited to the following:
    • The cost of the test automation tool and the ROI it offers over time
    • How well it fits with the team’s skillset
    • CI/CD Integration capabilities
    • Support for cross-device and cross-platform test setup and execution
    • Support for custom- scripting to extend the existing framework
    • Support for various technologies such as REST, SOAP, messaging systems (Kafka), and databases

Chapter 4, Getting Started with the Basics

  1. GitHub integration, debugging capabilities, build tools integration, plugins support, cost, and speed are important factors to consider when choosing an IDE.
  2. let allows the variable to be assigned a different value later in the program but const does not.
  3. The indexOf method returns the index of the element in the array. It returns –1 if the element is not found in the array.
  4. It has various advantages such as assigning multiple variables in a single statement, accessing properties from nested objects, and assigning a default value when a property doesn’t exist.
  5. A function is declared using the function keyword, followed by its name, parameters, and body. It can also have a return value.
  6. This command helps identify a certain commit that is buggy or caused certain tests to fail. It uses binary search to narrow down the search to a single commit from hundreds of commits.
  7. Start with a pull from remote or other branches before beginning any new work on the local code base. This keeps the local branch updated, thereby reducing merge conflicts
  8. Commit messages assist fellow engineers in gaining context on why a certain change was done.

Chapter 5, Test Automation for Web

  1. Cypress comes bundled with a lot of capabilities suitable for web test automation. Cypress also runs inside the browser, which allows it to test client functions directly.
  2. package.json is the primary configuration file for npm and can be found in the root directory of the project. It helps to run your application and handle all dependencies.
  3. Callback functions are mainly used to handle asynchronous aspects of modern web applications. They provide an avenue to wait and execute functions while returning control to the main block of execution.
  4. beforeEach blocks are used within a Cypress spec to enclose code that needs to run before every it block.
  5. The id attribute is selected using the # symbol.
  6. cy.intercept() is the command to intercept and mock API calls in Cypress.

Chapter 6, Test Automation for Mobile

  1. Appium involves multiple installations working in tandem, and it would be convenient to have a tool that could provide us with constant feedback on the health of our setup. appium-doctor does just that.
  2. The main downside of using an emulator is in replicating certain performance issues such as battery life and network connectivity. The test results in these areas may be unreliable. It also gets increasingly complicated to test device behavior when multi-tasking
  3. One of the major challenges is having good coverage for multiple device models and OS versions. Another challenge would be to accommodate localization testing where multiple geographical regions have to be considered for the same release of the application.
  4. The benefits of using CSPs for mobile test automation are as following:
    • Ability to scale
    • Test and debug issues faster
    • Save resources in setting up an in-house mobile testing lab
  5. Hooks are reusable code that can be run multiple times but defined only once. Hooks help reduce test dependency, which in turn helps reduce code duplication.

Chapter 7, Test Automation for APIs

  1. The primary focus of API testing is to validate the business logic of APIs, while other types of testing include performance and security. It involves the collection of test data to be sent in as JSON requests to the API and validating the response for accuracy. Some items to look for in the response are status, syntax, schema conformance, and functional correctness.
  2. Postman provides a way to group API requests using collections. This helps organize a workspace by breaking it down, and a workspace can also be sorted into multiple collections.
  3. Snippets are small code blocks readily available in Postman and can be selected for use in tests. They give an overview of frequently used API validations and save time in writing them.
  4. Postman allows the chaining of API requests, which enables the usage of variables from one request to another. In this manner, multiple requests can be tested as a series of calls.
  5. Newman is a command-line tool used in conjunction with Postman to execute collections.
  6. Docker is a platform that assists in building, deploying, and testing your application code on units called containers, irrespective of the underlying operating system. It provides great portability for developing and testing applications.
  7. GraphQL is a query language specification for APIs and helps design APIs in a client-driven architecture. It excels at getting all the data needed by the client in a single request.

Chapter 8, Test Automation for Performance

  1. JMeter is a performance-testing application built using Java. It is a completely free and open source tool created by Apache and it can be used to performance test a wide variety of applications, including APIs and databases.
  2. JMeter uses the thread group component to simulate user load by specifying the number of threads, the ramp-up period, and the loop count.
  3. Performance tests are often long running and tend to be heavy on system resource consumption. GUI mode consumes a lot of memory, especially when running pre-recorded scripts, and execution via the command line alleviates this pain by reducing the memory footprint of the tool. Additionally, the CLI offers integration with CI/CD.
  4. There may be instances where the features that come out of the box with JMeter are not sufficient and custom scripts are needed to perform specific tasks. JSR233 and Beanshell assertions/samplers can be utilized in cases such as these to get the job done.
  5. Distributed load testing is the process of mimicking the real-world user load and distributing the load across multiple machines/servers to uncover critical bugs or memory leaks.

Chapter 9, CI/CD and Test Automation

  1. CI/CD stands for Continuous Integration and Continuous Delivery. These software engineering practices allow us to automate the building and testing of code to validate it meets the specifications. After all the tests have passed, they equip the teams with options to automate the delivery of code. Continuous Integration, Continuous Delivery, and Continuous Deployment together significantly reduce the time it takes to deliver application enhancements while the engineering team can solely focus on product and code enhancements.
  2. A CI process is triggered when an engineer pushes code changes to the version control repository. A new instance of the CI pipeline is triggered where build and tests are executed.
  3. A CI server typically keeps polling the version control repository every minute or so and runs a preconfigured build script by fetching the latest version of the source files.
  4. Some of the key aspects involved in the CD methodology are:
    • Effective software configuration management
    • CI
    • Building and maintaining a deployment pipeline
    • Automatic infrastructure and environment management
  5. E2E tests should be configured to run on the pipeline for every deployment to a new environment.
  6. GitHub Actions is a CI/CD platform that enables the automation of building, testing, and deployment of application code. It is the built-in CI/CD tool for GitHub.

Chapter 10, Common Issues and Pitfalls

  1. It is the duty of SDETs and quality engineers to educate the stakeholders about the initial investment it takes see results from test automation. They should also highlight the importance of having skilled resources to address the complex application stack.
  2. Working on any kind of design work without considering maintenance aspects does not scale very well. In the pilot stages of a software project, it is vital to think through what kind of effort would go into maintaining a test automation framework after it is fully built and functional.
  3. Some ideas to select the right things to automate are as following:
    • Do not automate tests that do not need to be run frequently
    • Focus on stable business scenarios that can reap the benefit in the long run
    • Minimize automating tests at the UI layer Do not automate the usability aspects of your application
    • Avoid automating big and complex scenarios
  4. Code duplication hurts the maintainability of automation frameworks overall. It is important to remember the Rule of three when it comes to code duplication. Whenever there is a need to duplicate a chunk of code the third time, it needs to be abstracted into a separate method or class.
  5. A few key ways to use assertions are:
    • Certainly make use of assertions for validations in your test
    • Use multiple assertions in a test sparingly and only where necessary
    • Use appropriate type of assertions where applicable. Do not use the same kind of assertion for all validations
  6. Some important aspects to look for when reviewing test automation code are:
    • Formatting and Typos
    • Test execution failures
    • Hard-coded and static handling of variables
    • Potential for test flakiness
    • Design pattern deviations
    • Code duplication
    • Any invalid structural changes to the framework
    • Correct handling of config files and their values
  7. Some critical items to keep a track of when it comes to test automation are:
    • What is automated/not automated?
    • Tests not worth automating
    • Mapping of automated tests to manual test cases
    • List of bugs found identified through test automation
    • List of deferred test cases for automation
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.198.12