Salesforce provides an interface for testing callouts named HttpCalloutMock used to cover remote callouts. While adequate for simple callouts, in the real world you often need something more flexible, as in the case of multiple and varying responses from the same or varying endpoints. More precise testing and coverage can be obtained by extending the standard interface. Join us as we demonstrate a solution to use to enable the flexibility required for complex integration and synchronization apps.
The document provides an overview of API testing, including definitions of APIs and API testing, descriptions of common API methods like GET, POST, PUT, and DELETE, examples of API requests and responses, and advantages and challenges of API testing. It discusses basics like the API workflow, REST APIs, HTTP response codes, and types of API tests.
This document provides an overview of Selenium, an open source tool for automating web application testing. It discusses why and when to automate testing, the key features and components of Selenium including Selenium WebDriver, Selenium Grid, and Selenium IDE. It also covers how to install Selenium and write sample test scripts using Selenium commands. The document explains the architectures of Selenium Grid and the user interface of Selenium IDE. It concludes by discussing other uses of Selenium and the future of testing.
Enterprise software needs to be faster than the competition.
In this presentation we will explore what is performance testing, why it is important and when should you implement these tests.
The document provides guidelines for designing a robust test automation framework. It discusses that a well-designed framework increases testing efficiency and reduces costs. The key aspects of framework design include defining objectives, selecting the appropriate framework type, managing data, ensuring reusability, integrating with other tools, and flexible execution and reporting. Idexcel's test automation framework was created following these best practices to provide a maintainable and reusable framework.
WI15 cool new feature, Queueable Apex - The Queueable APEX is better option than @Future in APEX as users can track when the async operation gets completed and can also enqueue async operation with another.
The document discusses test management for software quality assurance, including defining test management as organizing and controlling the testing process and artifacts. It covers the phases of test management like planning, authoring, execution, and reporting. Additionally, it discusses challenges in test management, priorities and classifications for testing, and the role and responsibilities of the test manager.
The document provides an overview of API testing, including definitions of APIs and API testing, descriptions of common API methods like GET, POST, PUT, and DELETE, examples of API requests and responses, and advantages and challenges of API testing. It discusses basics like the API workflow, REST APIs, HTTP response codes, and types of API tests.
This document provides an overview of Selenium, an open source tool for automating web application testing. It discusses why and when to automate testing, the key features and components of Selenium including Selenium WebDriver, Selenium Grid, and Selenium IDE. It also covers how to install Selenium and write sample test scripts using Selenium commands. The document explains the architectures of Selenium Grid and the user interface of Selenium IDE. It concludes by discussing other uses of Selenium and the future of testing.
Enterprise software needs to be faster than the competition.
In this presentation we will explore what is performance testing, why it is important and when should you implement these tests.
The document provides guidelines for designing a robust test automation framework. It discusses that a well-designed framework increases testing efficiency and reduces costs. The key aspects of framework design include defining objectives, selecting the appropriate framework type, managing data, ensuring reusability, integrating with other tools, and flexible execution and reporting. Idexcel's test automation framework was created following these best practices to provide a maintainable and reusable framework.
WI15 cool new feature, Queueable Apex - The Queueable APEX is better option than @Future in APEX as users can track when the async operation gets completed and can also enqueue async operation with another.
The document discusses test management for software quality assurance, including defining test management as organizing and controlling the testing process and artifacts. It covers the phases of test management like planning, authoring, execution, and reporting. Additionally, it discusses challenges in test management, priorities and classifications for testing, and the role and responsibilities of the test manager.
The document discusses performance testing, which is done to evaluate how a system performs under certain workloads. It aims to determine a system's speed, scalability, stability and other quality attributes. The document outlines different types of performance tests like load testing and stress testing. It explains key performance metrics such as response time, throughput and how performance testing helps improve quality and reduce risks. Overall, performance testing is important to ensure applications meet expectations before release.
Manual testing is the process of testing software manually without automation. It involves various levels of testing like unit testing and system testing. Types of blackbox testing include functional and non-functional testing. The steps for manual testing are to understand documentation, draft test cases, execute test cases, report bugs, and retest after fixes. Sample testing points cover testing buttons, text fields, dropdowns, filters, and other common elements.
This document provides an overview of performance and load testing basics. It defines key terms like throughput, response time, and tuning. It explains the difference between performance, load, and stress testing. Performance testing is done to evaluate system speed, throughput, and utilization in comparison to other versions or products. Load testing exercises the system under heavy loads to identify problems, while stress testing tries to break the system. Performance testing should occur during design, development, and deployment phases to ensure system meets expectations under load. Key transactions like high frequency, mission critical, read, and update transactions should be tested. The testing process involves planning, recording test scripts, modifying scripts, executing tests, monitoring tests, and analyzing results.
Karate - Web-Service API Testing Made SimpleVodqaBLR
Karate is a DSL for writing web service API acceptance tests that is built on Cucumber and uses BDD syntax. It allows tests to be written in a concise and readable way while enabling faster test execution and better assertion capabilities. Karate tests can be easily integrated into existing CI/CD pipelines.
The document discusses automation testing basics, including that automation testing is done using automated tools to write and execute test cases. It explains that automation testing should be used for tasks that are time-consuming, repeated, tedious, or involve high risk test cases. The document also lists some popular free and commercial automation testing tools.
Chapter 3 - Performance Testing in the Software LifecycleNeeraj Kumar Singh
The document discusses performance testing activities across different software development lifecycles. It describes how performance testing should be conducted iteratively throughout sequential development models, with testing at each stage from concept to acceptance. For iterative models, performance testing is also iterative and can be part of continuous integration. Specific activities discussed include test planning, monitoring, analysis, design, implementation, execution and completion. Performance risks are also discussed for different architectures.
In this Quality Assurance Training session, you will learn about Automation Tools Overview. Topic covered in this session are:
• SQL Basic Operators and Function
• Software Testing Tool – Overview
• Advantage- Automation
• Disadvantage - Automation
• Grouping of Automation Tool
• Functional Tool
• Source Code Testing Tool
• Performance Tool
• Test Management Tool
• Security Testing Tool
For more information, about this quality assurance training, visit this link: https://www.mindsmapped.com/courses/quality-assurance/software-testing-training-with-hands-on-project-on-e-commerce-application/
In this Business Analysis training session, you will learn about SDLC. Topics covered in this session are:
• SDLC (Software Development Life Cycle)
• Types of SDLC Methodologies
• Waterfall Approach
• Incremental Approach
• Iterative Approach
• Difference between Incremental and Iterative
• Prototype Approach
• Spiral Approach
• Overview of RUP
• Phases of RUP
• Activity
• Artifact
• Worker
• Worflow
• Overview of Agile
For more information, click here: https://www.mindsmapped.com/courses/business-analysis/become-a-business-analyst-with-hands-on-practice/
This document provides an overview of test automation using Selenium. It discusses what automated testing is and why it is used. The main advantages of automated testing are that it saves time and money, increases test coverage, and improves accuracy over manual testing. Selenium is then introduced as a popular open source tool for automated testing of web applications. The key components of Selenium include the core library, IDE for recording and playback of tests, remote control for distributing tests across browsers, web drivers for native browser control, and grid for parallel testing across environments.
Behavior Driven development is the process of exploring, discovering, defining and driving the desired behavior of software system by using conversation, concrete examples and automated tests.
Performance testing interview questions and answersGaruda Trainings
In software engineering, performance testing is in general testing performed to determine how a system performs in terms of responsiveness and stability under a particular workload. It can also serve to investigate, measure, validate or verify other quality attributes of the system, such as scalability, reliability and resource usage.
Performance Testing And Its Type | Benefits Of Performance TestingKostCare
Performance testing is in general, a testing practice performed to determine how a system performs in terms of responsiveness and stability under a particular workload. It can also serve to investigate, measure, validate or verify other quality attributes of the system, such as scalability, reliability and resource usage.
The document discusses test automation, including introducing automation, tools, frameworks, and strategies. It describes different types of frameworks like test script modularity, library architecture, keyword-driven, and data-driven testing. Critical factors for automation success are having management support, a robust framework, test process ownership, and skilled professionals. Risks include changes impacting scripts and lack of automation knowledge.
This document discusses Karate DSL, an API testing framework that allows for writing API tests in a plain text format using a domain-specific language. Some key benefits of Karate DSL include readable and maintainable test scripts, powerful JSON and XML validation capabilities, data-driven testing using JSON or CSV files, parallel test execution, and easy integration with reporting tools. The document provides examples of testing GET, POST, PUT, and DELETE requests and validating responses. It also discusses best practices for reusable test functions, database validation, and keeping test scenarios independent.
Karate - powerful and simple framework for REST API automation testingRoman Liubun
Karate is a powerful yet simple framework for REST API automation testing. It uses a behavior-driven development style with tests written in a domain-specific language that resembles simple English. Key features include reusable tests, schema validation, data-driven testing with examples, parallel test execution, and built-in reporting. While requiring learning a new language, Karate provides many capabilities out of the box and removes the need for complex programming.
What are the Key drivers for automation? What are the Challenges in Agile automation and How to deal with them? How to automate? Who will automate? Which tool to select? Commercial or open source? What to automate? Which features? Here is what our experience says
Load testing simulates multiple users accessing an application simultaneously to evaluate performance under different load scenarios. There are three main types of load testing:
1. Performance testing gradually increases load to determine the maximum number of users/requests per second an application can handle.
2. Stress testing pushes load beyond normal limits to identify the breaking point and ensure error handling.
3. Soak testing subjects an application to high load over an extended period to check for resource allocation problems, memory leaks, and server overloading.
The tool JMeter is commonly used for load testing and allows simulating many users and transactions. It can test HTTP, databases, and other components. Plugins extend its functionality and distributed testing improves load
Enhanced Web Service Testing: A Better Mock StructureCRMScienceKirk
Salesforce provides an interface for testing callouts named HttpCalloutMock used to cover remote callouts. While adequate for simple callouts, in the real world you often need something more flexible, as in the case of multiple and varying responses from the same or varying endpoints. More precise testing and coverage can be obtained by extending the standard interface. Join us as we demonstrate a solution to use to enable the flexibility required for complex integration and synchronization apps.
Developer testing 101: Become a Testing FanaticLB Denker
In this workshop we will cover the methodologies and three basic levels of testing, then we will deep dive into how to use PHPUnit to achieve developer testing. The tests may not be the prettiest, most robust, or efficient, but you should leave the course with the ability and confidence to write tests for your code.
Topics include: xUnit framework basics and workflows, test classification, asserts, data driven testing, and an introduction to mocking.
This is a beginner course, but seasoned veterans may discover features they never knew.
The document discusses performance testing, which is done to evaluate how a system performs under certain workloads. It aims to determine a system's speed, scalability, stability and other quality attributes. The document outlines different types of performance tests like load testing and stress testing. It explains key performance metrics such as response time, throughput and how performance testing helps improve quality and reduce risks. Overall, performance testing is important to ensure applications meet expectations before release.
Manual testing is the process of testing software manually without automation. It involves various levels of testing like unit testing and system testing. Types of blackbox testing include functional and non-functional testing. The steps for manual testing are to understand documentation, draft test cases, execute test cases, report bugs, and retest after fixes. Sample testing points cover testing buttons, text fields, dropdowns, filters, and other common elements.
This document provides an overview of performance and load testing basics. It defines key terms like throughput, response time, and tuning. It explains the difference between performance, load, and stress testing. Performance testing is done to evaluate system speed, throughput, and utilization in comparison to other versions or products. Load testing exercises the system under heavy loads to identify problems, while stress testing tries to break the system. Performance testing should occur during design, development, and deployment phases to ensure system meets expectations under load. Key transactions like high frequency, mission critical, read, and update transactions should be tested. The testing process involves planning, recording test scripts, modifying scripts, executing tests, monitoring tests, and analyzing results.
Karate - Web-Service API Testing Made SimpleVodqaBLR
Karate is a DSL for writing web service API acceptance tests that is built on Cucumber and uses BDD syntax. It allows tests to be written in a concise and readable way while enabling faster test execution and better assertion capabilities. Karate tests can be easily integrated into existing CI/CD pipelines.
The document discusses automation testing basics, including that automation testing is done using automated tools to write and execute test cases. It explains that automation testing should be used for tasks that are time-consuming, repeated, tedious, or involve high risk test cases. The document also lists some popular free and commercial automation testing tools.
Chapter 3 - Performance Testing in the Software LifecycleNeeraj Kumar Singh
The document discusses performance testing activities across different software development lifecycles. It describes how performance testing should be conducted iteratively throughout sequential development models, with testing at each stage from concept to acceptance. For iterative models, performance testing is also iterative and can be part of continuous integration. Specific activities discussed include test planning, monitoring, analysis, design, implementation, execution and completion. Performance risks are also discussed for different architectures.
In this Quality Assurance Training session, you will learn about Automation Tools Overview. Topic covered in this session are:
• SQL Basic Operators and Function
• Software Testing Tool – Overview
• Advantage- Automation
• Disadvantage - Automation
• Grouping of Automation Tool
• Functional Tool
• Source Code Testing Tool
• Performance Tool
• Test Management Tool
• Security Testing Tool
For more information, about this quality assurance training, visit this link: https://www.mindsmapped.com/courses/quality-assurance/software-testing-training-with-hands-on-project-on-e-commerce-application/
In this Business Analysis training session, you will learn about SDLC. Topics covered in this session are:
• SDLC (Software Development Life Cycle)
• Types of SDLC Methodologies
• Waterfall Approach
• Incremental Approach
• Iterative Approach
• Difference between Incremental and Iterative
• Prototype Approach
• Spiral Approach
• Overview of RUP
• Phases of RUP
• Activity
• Artifact
• Worker
• Worflow
• Overview of Agile
For more information, click here: https://www.mindsmapped.com/courses/business-analysis/become-a-business-analyst-with-hands-on-practice/
This document provides an overview of test automation using Selenium. It discusses what automated testing is and why it is used. The main advantages of automated testing are that it saves time and money, increases test coverage, and improves accuracy over manual testing. Selenium is then introduced as a popular open source tool for automated testing of web applications. The key components of Selenium include the core library, IDE for recording and playback of tests, remote control for distributing tests across browsers, web drivers for native browser control, and grid for parallel testing across environments.
Behavior Driven development is the process of exploring, discovering, defining and driving the desired behavior of software system by using conversation, concrete examples and automated tests.
Performance testing interview questions and answersGaruda Trainings
In software engineering, performance testing is in general testing performed to determine how a system performs in terms of responsiveness and stability under a particular workload. It can also serve to investigate, measure, validate or verify other quality attributes of the system, such as scalability, reliability and resource usage.
Performance Testing And Its Type | Benefits Of Performance TestingKostCare
Performance testing is in general, a testing practice performed to determine how a system performs in terms of responsiveness and stability under a particular workload. It can also serve to investigate, measure, validate or verify other quality attributes of the system, such as scalability, reliability and resource usage.
The document discusses test automation, including introducing automation, tools, frameworks, and strategies. It describes different types of frameworks like test script modularity, library architecture, keyword-driven, and data-driven testing. Critical factors for automation success are having management support, a robust framework, test process ownership, and skilled professionals. Risks include changes impacting scripts and lack of automation knowledge.
This document discusses Karate DSL, an API testing framework that allows for writing API tests in a plain text format using a domain-specific language. Some key benefits of Karate DSL include readable and maintainable test scripts, powerful JSON and XML validation capabilities, data-driven testing using JSON or CSV files, parallel test execution, and easy integration with reporting tools. The document provides examples of testing GET, POST, PUT, and DELETE requests and validating responses. It also discusses best practices for reusable test functions, database validation, and keeping test scenarios independent.
Karate - powerful and simple framework for REST API automation testingRoman Liubun
Karate is a powerful yet simple framework for REST API automation testing. It uses a behavior-driven development style with tests written in a domain-specific language that resembles simple English. Key features include reusable tests, schema validation, data-driven testing with examples, parallel test execution, and built-in reporting. While requiring learning a new language, Karate provides many capabilities out of the box and removes the need for complex programming.
What are the Key drivers for automation? What are the Challenges in Agile automation and How to deal with them? How to automate? Who will automate? Which tool to select? Commercial or open source? What to automate? Which features? Here is what our experience says
Load testing simulates multiple users accessing an application simultaneously to evaluate performance under different load scenarios. There are three main types of load testing:
1. Performance testing gradually increases load to determine the maximum number of users/requests per second an application can handle.
2. Stress testing pushes load beyond normal limits to identify the breaking point and ensure error handling.
3. Soak testing subjects an application to high load over an extended period to check for resource allocation problems, memory leaks, and server overloading.
The tool JMeter is commonly used for load testing and allows simulating many users and transactions. It can test HTTP, databases, and other components. Plugins extend its functionality and distributed testing improves load
Enhanced Web Service Testing: A Better Mock StructureCRMScienceKirk
Salesforce provides an interface for testing callouts named HttpCalloutMock used to cover remote callouts. While adequate for simple callouts, in the real world you often need something more flexible, as in the case of multiple and varying responses from the same or varying endpoints. More precise testing and coverage can be obtained by extending the standard interface. Join us as we demonstrate a solution to use to enable the flexibility required for complex integration and synchronization apps.
Developer testing 101: Become a Testing FanaticLB Denker
In this workshop we will cover the methodologies and three basic levels of testing, then we will deep dive into how to use PHPUnit to achieve developer testing. The tests may not be the prettiest, most robust, or efficient, but you should leave the course with the ability and confidence to write tests for your code.
Topics include: xUnit framework basics and workflows, test classification, asserts, data driven testing, and an introduction to mocking.
This is a beginner course, but seasoned veterans may discover features they never knew.
The document provides an overview of testing Apex code in Salesforce, including:
- Why unit testing is important for developing robust, error-free code that meets the minimum 75% test coverage requirement.
- How to write Apex test classes annotated with @isTest and define test methods using testMethod.
- Using Test.startTest() and Test.stopTest() to test governor limits.
- Examples of testing a trigger, visualforce controller, web services callouts, and external API callouts.
- Best practices for testing such as using System.assert(), achieving 100% coverage, and testing different user contexts with System.runAs().
Performance Test Driven Development with Oracle Coherencearagozin
This presentation discusses test driven development with Oracle Coherence. It outlines the philosophy of PTDD and challenges of testing Coherence, including the need for a cluster and sensitivity to network issues. It discusses automating tests using tools like NanoCloud for managing nodes and executing tests remotely. Different types of tests are described like microbenchmarks, performance regression tests, and bottleneck analysis. Common pitfalls of performance testing like fixed users vs fixed request rates are also covered.
This document discusses different types of software testing including unit testing and integration testing. Unit testing involves writing code to test individual units or modules in isolation with few dependencies. Integration testing evaluates how modules function together as a group in a black box manner. The benefits of testing include facilitating code changes, enhancing software quality by catching bugs, serving as documentation, and improving code quality. Test-driven development is introduced as an approach where tests are written before code to drive the design. Continuous integration is also discussed as a way to fully automate testing, build, and code quality checks.
This document discusses using web services in Android development. It covers making HTTP requests to web services, parsing the response, and creating your own basic web service using PHP. Key points include constructing the URL, executing asynchronous HTTP requests, checking response codes, and parsing XML or JSON responses. The document provides code samples for making a request and handling the response. It also discusses possible issues like blocking the UI thread during the request and suggests using threads to avoid this. Finally, it proposes an exercise to build an accessible application using a web service and GPS.
Web Services Automated Testing via SoapUI ToolSperasoft
soapUI is a tool for testing APIs, including SOAP and REST web services. It allows testing functionality, security, performance, and documentation. Key features include testing API functions with parameters, negative testing, security testing like SQL injection and XSS, load and performance testing, and documentation logging. The tool supports SOAP, REST, and HTTP services. Projects contain elements like WSDL/WADL files, services, test cases, test steps, and property transfers between steps. Test cases validate requests with parameters and assertions. Security tests simulate attacks. Performance tests assess response times and throughput under varying loads. Mock services emulate real services for testing without dependencies.
This document discusses connectivity in SQL and JDBC. It begins by explaining that JDBC is a Java API that allows Java programs to execute SQL statements. It then describes the JDBC architecture and drivers. The responsibilities of the JDBC client include establishing a connection, submitting SQL statements, processing results, and closing the connection. The document outlines the steps to develop a Java/JDBC application, including loading and registering drivers, establishing a connection, preparing and executing statements, processing result sets, and closing connections. Finally, it compares Statement and PreparedStatement objects.
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)Jen Wong
FitNesse is a wiki-based software testing tool that can be a powerful addition to your Continuous Integration Environments. Its greatest advantages include providing visibility into tests and results, and providing access to test-writing by non-technical team members. We will:
* look at specific examples and code,
* discuss the advantages and drawbacks of using FitNesse as a test framework
* implement, deploy, and use a simple fixture in a fitnesse test
* review different kinds of fixtures, including decision table, script, query, html, and selenium webtest fixtures
* discuss some of the more interesting fixture extensions we've implemented, including JSON-based verification and the ability to pass in javascript code for dynamic verification
* use Hudson/Jenkins to run your FitNesse tests as a step in your Continuous Integration/Deployment process
This document discusses PHPUnit, a unit testing framework for PHP. It covers PHPUnit installation, writing test cases, assertions, fixtures, organizing tests, and best practices for test naming, structure and design including the F.I.R.S.T. principles. Key topics include using PHPUnit to test classes, methods and exceptions, leveraging data providers, fixtures for shared test setup/teardown, and keeping tests clean with single concepts per test.
7.1 Identify which attribute scopes are thread-safe:
Local variables
Instance variables
Class variables
Request attributes
Session attributes
Context attributes
7.2 Identify correct statements about differences between the multithreaded and single-threaded servlet models.
7.3 Identify the interface used to declare that a servlet must use the single thread model.
The document discusses test-driven development (TDD). It states that TDD relies on short development cycles where the developer first writes an automated test case that defines a new function or improvement. Then the developer produces code to pass that test, and refactors the new code to acceptable standards.
The document discusses unit testing with the Spock testing framework. It introduces Spock and outlines key concepts like the three pillars of good unit tests, Spock idioms, mocks and stubs, and continuous integration. Spock provides an expressive testing language based on Groovy that makes tests more readable, maintainable and trustworthy. Examples demonstrate how to write feature methods, use blocks, verify interactions, stub implementations, test exceptions, integrate with Spring, and perform HTTP calls and data-driven testing with Spock.
This document discusses unit testing practices for SharePoint 2010. It notes that SharePoint objects are difficult to test because they lack interfaces and are sealed classes. It introduces Pex and Moles mocking frameworks that can generate stubs for SharePoint objects using runtime instrumentation. The document demonstrates using SharePoint Mole Behaviors to pre-generate common SharePoint object behaviors. It observes that this approach saves time but behaviors may not be complete and unit tests can run slowly. It recommends building a facade in front of SharePoint and producing consistent behaviors by disassembling SharePoint if necessary.
This document provides an overview of API testing and web services protocols. It discusses XML, SOAP, REST, and introduces the tool SoapUI for testing web services. Key points include:
1. XML is used to transport and store data on the web. It has elements, attributes, and syntax rules. XML Namespaces avoid element name conflicts.
2. SOAP is a protocol for accessing web services. It uses XML, includes envelope, header and body elements. WSDL describes SOAP web services operations.
3. REST services use HTTP to manipulate resources via operations like GET, PUT, POST and DELETE. It can output JSON, XML and is language/platform independent.
4.
Have you ever wondered how Ajax requests fit in with WebObject's Request-Response loop? Have you ever wanted to make a new Ajax component or debug a problem in an existing one? Do you want to use a different JavaScript library with WebObjects? This session will look at what was done to make Ajax work in a component action world, looking at changes to the Request-Response loop and the page cache. You will learn how to use AjaxComponent, AjaxDynamicElement, and the other classes that are used to create WebObjects Ajax components.
The document provides information on servlet fundamentals including definitions, applications, architecture, lifecycle, and development process. Some key points include:
- Servlets are Java programs that run on web servers and interact with clients via HTTP requests and responses. They provide dynamic content and process user input.
- Common servlet applications include search engines, e-commerce sites, and intranets.
- The servlet lifecycle includes initialization, processing requests, and destruction. Servlets remain loaded in memory between requests for improved performance over CGI.
- To develop a servlet, you create a class that implements the Servlet interface, define request handling methods, compile it, deploy it in a web container
This document provides an overview and examples for building web APIs with ASP.NET Web API. It discusses Richardson maturity levels, the HTTP request/response processing pipeline, attribute routing, and implementing handlers. It also demonstrates testing Web API controllers with the WebApiTestClient without requiring a running host. Key topics include building controllers, adding OData query support, creating an authorization handler, and following the Arrange, Act, Assert pattern for tests.
The presentation explains the PHP unit testing framework and provides a basic training on Testing with PHPunit. It Covers fundamental of unit testing, unit testing benefits and best practices. Starting ground up from PHP unit fundamentals, features of unit testing tries to explore advanced topics like Data providers, Fuxtures, Test doubles and more...
Developer testing 201: When to Mock and When to IntegrateLB Denker
This workshop is for those who know how to write developer tests in PHPUnit. This workshop will expand upon that knowledge and further emphasize the difference between unit testing and integration testing. We will cover better tools and techniques for integration testing with databases and external services, and we will cover advanced mocking techniques to maintain a more fast and robust test suite.
Topics include: DBUnit, PHPUnit Mocks, Mockery, vfsStream
This course requires prior experience with PHPUnit or the 'Developer Testing 101: Become a Testing Fanatic' course.
Similar to Enhanced Web Service Testing: A Better Mock Structure (20)
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSalesforce Developers
This document provides an overview of the Salesforce Sample Gallery, which contains sample applications, reference code, and best practices for Salesforce developers. It describes different types of sample apps, including recipe style apps with specific code examples and standalone apps that demonstrate features. The document also outlines upcoming updates to the gallery, such as adding new applications and retiring outdated ones. It promotes benefits like inspiration, learning open source code, and understanding development best practices.
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceSalesforce Developers
The document discusses various factors that affect the performance of Lightning Experience and Lightning Component pages. It outlines six main factors: geographical and network latency, device and browser capabilities, Salesforce org configuration, page complexity, component architecture, and server processing. For each factor, it provides recommendations for how to measure and optimize performance, such as enabling the Salesforce Edge network, limiting the number of components on a page, using conditional rendering, and leveraging caching features. The overall message is that page load time in Lightning Experience is sensitive to these infrastructure, code, and configuration factors.
Last year was eventful for Salesforce Developers - we started with the launch of Lightning Web Components (LWC), open-sourced it, enabled local development, and ended the year by open-sourcing Base Lightning Components. In this webinar, we will explore exciting new developments within Base Components and we will show you how to use open-source Base Components to build engaging applications faster with local development.
In this session we will,
- Spin up a local development environment to build Lightning web components
- Use and customize the base components and recipes to build pages and apps quickly
- Explore the latest features of VS Code developer tooling while coding for a use case
Over the past two months, we’ve announced many new resources for developers at Dreamforce and TrailheaDX India. To learn all about them, watch this video, where we'll explore live demos showcasing the latest updates for Lightning Web Components (LWC), Einstein, Heroku, and a lot more on the Customer 360 Platform.
In this session we,
- Explore key highlights from TrailheaDX India
- Show live demos of generally available features
- Explain how you can benefit from these features
TrailheaDX (TDX) is coming to ‘namma’ Bengaluru in India on Dec 19th and 20th! TrailheaDX India is the conference for everyone who builds on and customises Salesforce — including admins, developers, architects, and partners. This event will have sessions, demos and fun for those just getting started with the platform, as well as for advanced admins, architects and developers.
You might have questions about the event - and to answer your questions Kavindra Patel, known as the father of the Indian Salesforce Community, joins Shashank Srivatsavaya, Head of APAC Developer Relations. Register for our exclusive webinar to:
- Get a sneak peek into exclusive sessions and activities
- Find out who you shouldn’t miss at TrailheaDX India
- Understand what comes with your #TDX19 registration
CodeLive: Build Lightning Web Components faster with Local DevelopmentSalesforce Developers
GitHub repo: https://github.com/satyasekharcvb/lwc-local-dev.git
With the release of a new beta version of Local Development, you can now build Lightning web components faster than ever before! You can now render changes, iterate rapidly, troubleshoot errors, and even connect with data from your org by spinning up a local development server on your machine.
In this session, we build Lightning web components in real time. The exciting new capabilities we showcase will enable you to be an even more productive developer.
In this CodeLive session we:
- Spin up a local development server from the CLI to rapidly edit and view components
- Observe how a rich error handling experience simplifies testing and debugging
- Learn how to proxy data from an org for more context and fine-tuned development
CodeLive: Converting Aura Components to Lightning Web ComponentsSalesforce Developers
This document provides information about a Salesforce webinar on converting Aura components to Lightning Web Components (LWC). The webinar will feature two presenters demonstrating how to convert Aura components to LWC. The document includes forward-looking statements and disclaimers about product availability. It also provides information on asking questions during the webinar and resources for continuing the learning journey with Trailhead and the Trailblazer community.
Earlier this year, we released Lightning Web Components (LWC), a new UI framework based on web standards and optimized for performance and developer productivity. We have now open sourced the Lightning Web Components framework so that anyone can build applications on any platform.
Join our webinar where we'll explore how this framework, based on standard HTML, modern JavaScript (ES6+), and the best of native Web Components, helps you create web components and apps using the stack and tools you prefer.
We recently announced over 300 new features and enhancements at TrailheaDX '19 and for the Summer '19 release. In our Developer Highlights webinar we explore the top features with in-depth demos, including the latest updates for Lightning Web Components (LWC), LWC Open Source, CLI updates, Change Data Capture for external objects, Asynchronous Apex Triggers, Notification Builder and more.
Watch the recording here: https://youtu.be/kmOkk74QiCo
You can watch a recording of the live coding session at https://sforce.co/2IbU3yJ
In the fifth and final webinar of our five part series, we learn how to build Lightning web components for different use cases. We explore how to leverage all of the concepts you’ve learned in this webinar series to create modern apps with Lightning Web Components. We also demonstrate various ways to migrate Aura components to Lightning web components for a seamless transition.
This document discusses Lightning Web Components security and testing. It begins with forward-looking statements and risks related to new functionality, products, and services. It then provides information on debugging code, including using browser tools and debugging in different modes. Finally, it discusses unit testing Lightning Web Components with Jest, including prerequisites, configuration, and an example test file.
LWC Episode 3- Component Communication and Aura InteroperabilitySalesforce Developers
Lightning Web Components gives JavaScript developers a web standards-based path to building apps on the Salesforce Lightning Platform.
In the third episode of our five part series on Lightning Web Components, we cover design considerations and compositions of Lightning Web Components.
This document provides an overview of Lightning Web Components Episode 2 which focuses on working with Salesforce data. It discusses how the Lightning Data Service and UI API are used to retrieve and display Salesforce record data. It also demonstrates how to use wire services to connect Lightning Web Components to Apex methods to retrieve and manipulate data. The document concludes with instructions for configuring Lightning Web Components to be used in the Lightning App Builder.
Lightning Web Components are a JavaScript programming model for building web applications and interfaces that is built on the best of web standards.
Any front-end web developer can get started with LWC and leverage custom elements, and JavaScript APIs to create modern apps and experiences that are fully aware of Salesforce data and processes.
Migrate legacy Salesforce CPQ to Advanced Calculator with the help of JSQCP. With Advanced Calculator, you can boost the runtime of quote creation. Join this webinar to learn what is required for migration - we’ll also walk through JSQCP.
This document discusses techniques for addressing large data volumes (LDV) in Salesforce orgs, including big objects. Big objects are a special type of object designed to store and retrieve large data volumes using big data technology. The document also provides a use case where a company wants to archive closed cases to free up storage space while maintaining access. It recommends using a custom big object to address these needs. The webinar will demonstrate creating and deploying a custom big object and retrieving data using asynchronous SOQL.
Replicate Salesforce Data in Real Time with Change Data CaptureSalesforce Developers
Migrate your batch processing, scheduled ETL, and nightly workloads to event-driven, real-time integrations using Change Data Capture. CDC means data change events are published to an event stream, allowing businesses to have up-to-date information across systems and applications. Join us to learn how to configure Change Data Capture and subscribe to the stream of change events, streamlining your architectures and processes.
This document provides an overview of modern development with Salesforce DX. It discusses using source control and metadata with scratch orgs and the Salesforce CLI for source-driven development. Visual Studio Code is highlighted as an IDE for Salesforce development with features like the Salesforce extension pack. The document contrasts traditional org-based development with the new paradigm of package development where changes are tracked relative to package versions. It demonstrates these concepts with a live demo and encourages attendees to learn more on Trailhead.
Lightning Flow makes it easier for developers to build dynamic process-driven apps with Process Builder and the new Flow Builder. Join us and learn more about how you can get in the Flow!
Integrate CMS Content Into Lightning Communities with CMS ConnectSalesforce Developers
In this webinar we will show you how to display content from external Content Management Systems into Lightning Communities. This lets you take advantage of the Communities framework and help you centralize content in whatever CMS system you have chosen.
Taking AI to the Next Level in Manufacturing.pdfssuserfac0301
Read Taking AI to the Next Level in Manufacturing to gain insights on AI adoption in the manufacturing industry, such as:
1. How quickly AI is being implemented in manufacturing.
2. Which barriers stand in the way of AI adoption.
3. How data quality and governance form the backbone of AI.
4. Organizational processes and structures that may inhibit effective AI adoption.
6. Ideas and approaches to help build your organization's AI strategy.
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor IvaniukFwdays
At this talk we will discuss DDoS protection tools and best practices, discuss network architectures and what AWS has to offer. Also, we will look into one of the largest DDoS attacks on Ukrainian infrastructure that happened in February 2022. We'll see, what techniques helped to keep the web resources available for Ukrainians and how AWS improved DDoS protection for all customers based on Ukraine experience
Dandelion Hashtable: beyond billion requests per second on a commodity serverAntonios Katsarakis
This slide deck presents DLHT, a concurrent in-memory hashtable. Despite efforts to optimize hashtables, that go as far as sacrificing core functionality, state-of-the-art designs still incur multiple memory accesses per request and block request processing in three cases. First, most hashtables block while waiting for data to be retrieved from memory. Second, open-addressing designs, which represent the current state-of-the-art, either cannot free index slots on deletes or must block all requests to do so. Third, index resizes block every request until all objects are copied to the new index. Defying folklore wisdom, DLHT forgoes open-addressing and adopts a fully-featured and memory-aware closed-addressing design based on bounded cache-line-chaining. This design offers lock-free index operations and deletes that free slots instantly, (2) completes most requests with a single memory access, (3) utilizes software prefetching to hide memory latencies, and (4) employs a novel non-blocking and parallel resizing. In a commodity server and a memory-resident workload, DLHT surpasses 1.6B requests per second and provides 3.5x (12x) the throughput of the state-of-the-art closed-addressing (open-addressing) resizable hashtable on Gets (Deletes).
Skybuffer SAM4U tool for SAP license adoptionTatiana Kojar
Manage and optimize your license adoption and consumption with SAM4U, an SAP free customer software asset management tool.
SAM4U, an SAP complimentary software asset management tool for customers, delivers a detailed and well-structured overview of license inventory and usage with a user-friendly interface. We offer a hosted, cost-effective, and performance-optimized SAM4U setup in the Skybuffer Cloud environment. You retain ownership of the system and data, while we manage the ABAP 7.58 infrastructure, ensuring fixed Total Cost of Ownership (TCO) and exceptional services through the SAP Fiori interface.
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...Jason Yip
The typical problem in product engineering is not bad strategy, so much as “no strategy”. This leads to confusion, lack of motivation, and incoherent action. The next time you look for a strategy and find an empty space, instead of waiting for it to be filled, I will show you how to fill it in yourself. If you’re wrong, it forces a correction. If you’re right, it helps create focus. I’ll share how I’ve approached this in the past, both what works and lessons for what didn’t work so well.
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
Generating privacy-protected synthetic data using Secludy and MilvusZilliz
During this demo, the founders of Secludy will demonstrate how their system utilizes Milvus to store and manipulate embeddings for generating privacy-protected synthetic data. Their approach not only maintains the confidentiality of the original data but also enhances the utility and scalability of LLMs under privacy constraints. Attendees, including machine learning engineers, data scientists, and data managers, will witness first-hand how Secludy's integration with Milvus empowers organizations to harness the power of LLMs securely and efficiently.
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsDianaGray10
Join us to learn how UiPath Apps can directly and easily interact with prebuilt connectors via Integration Service--including Salesforce, ServiceNow, Open GenAI, and more.
The best part is you can achieve this without building a custom workflow! Say goodbye to the hassle of using separate automations to call APIs. By seamlessly integrating within App Studio, you can now easily streamline your workflow, while gaining direct access to our Connector Catalog of popular applications.
We’ll discuss and demo the benefits of UiPath Apps and connectors including:
Creating a compelling user experience for any software, without the limitations of APIs.
Accelerating the app creation process, saving time and effort
Enjoying high-performance CRUD (create, read, update, delete) operations, for
seamless data management.
Speakers:
Russell Alfeche, Technology Leader, RPA at qBotic and UiPath MVP
Charlie Greenberg, host
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/temporal-event-neural-networks-a-more-efficient-alternative-to-the-transformer-a-presentation-from-brainchip/
Chris Jones, Director of Product Management at BrainChip , presents the “Temporal Event Neural Networks: A More Efficient Alternative to the Transformer” tutorial at the May 2024 Embedded Vision Summit.
The expansion of AI services necessitates enhanced computational capabilities on edge devices. Temporal Event Neural Networks (TENNs), developed by BrainChip, represent a novel and highly efficient state-space network. TENNs demonstrate exceptional proficiency in handling multi-dimensional streaming data, facilitating advancements in object detection, action recognition, speech enhancement and language model/sequence generation. Through the utilization of polynomial-based continuous convolutions, TENNs streamline models, expedite training processes and significantly diminish memory requirements, achieving notable reductions of up to 50x in parameters and 5,000x in energy consumption compared to prevailing methodologies like transformers.
Integration with BrainChip’s Akida neuromorphic hardware IP further enhances TENNs’ capabilities, enabling the realization of highly capable, portable and passively cooled edge devices. This presentation delves into the technical innovations underlying TENNs, presents real-world benchmarks, and elucidates how this cutting-edge approach is positioned to revolutionize edge AI across diverse applications.
"Choosing proper type of scaling", Olena SyrotaFwdays
Imagine an IoT processing system that is already quite mature and production-ready and for which client coverage is growing and scaling and performance aspects are life and death questions. The system has Redis, MongoDB, and stream processing based on ksqldb. In this talk, firstly, we will analyze scaling approaches and then select the proper ones for our system.
Introduction of Cybersecurity with OSS at Code Europe 2024Hiroshi SHIBATA
I develop the Ruby programming language, RubyGems, and Bundler, which are package managers for Ruby. Today, I will introduce how to enhance the security of your application using open-source software (OSS) examples from Ruby and RubyGems.
The first topic is CVE (Common Vulnerabilities and Exposures). I have published CVEs many times. But what exactly is a CVE? I'll provide a basic understanding of CVEs and explain how to detect and handle vulnerabilities in OSS.
Next, let's discuss package managers. Package managers play a critical role in the OSS ecosystem. I'll explain how to manage library dependencies in your application.
I'll share insights into how the Ruby and RubyGems core team works to keep our ecosystem safe. By the end of this talk, you'll have a better understanding of how to safeguard your code.
Discover top-tier mobile app development services, offering innovative solutions for iOS and Android. Enhance your business with custom, user-friendly mobile applications.
AppSec PNW: Android and iOS Application Security with MobSFAjin Abraham
Mobile Security Framework - MobSF is a free and open source automated mobile application security testing environment designed to help security engineers, researchers, developers, and penetration testers to identify security vulnerabilities, malicious behaviours and privacy concerns in mobile applications using static and dynamic analysis. It supports all the popular mobile application binaries and source code formats built for Android and iOS devices. In addition to automated security assessment, it also offers an interactive testing environment to build and execute scenario based test/fuzz cases against the application.
This talk covers:
Using MobSF for static analysis of mobile applications.
Interactive dynamic security assessment of Android and iOS applications.
Solving Mobile app CTF challenges.
Reverse engineering and runtime analysis of Mobile malware.
How to shift left and integrate MobSF/mobsfscan SAST and DAST in your build pipeline.
4. • Code we write…
• …about the code we just wrote
• Test classes
• Independent of code being tested
• One or more test methods
• @isTest annotation
Apex Test Coverage
“What” with a Hint of “How”
5. Apex Test Coverage
A Bit More of “How”
Grandma’s Famous Recipe
1. Write code to do
something
2. Create test class
3. Mark with @isTest
4. Create test method
5. Create test data
6. Invoke code being
tested
7. Assert (+ or -)
6. • Code we write…
• …about the code we just wrote
• Test classes
• Independent of code being tested
• One or more test method
Apex Test Coverage
Now More “What”
7. • You, me, everyone
• Required
• 75%
• Ongoing Development
• Help catch regressions
• Positive and negative assertions
Apex Test Coverage
“Who-ot” and “Why”
8. • As you’re developing
• Moving code from sandbox to production
• Creating packages
Apex Test Coverage
When
10. • Class w/ single method that makes a callout
Sample Scenario: Single Callout
Class Needing Coverage
11. Sample Scenario: Single Callout
Class Needing Coverage
Gist: https://gist.github.com/KirkSteffke/2ca4357c7e84eece9073
12. • Method making callout needs coverage
• Don’t want test methods to actually make callout!
• Responses to be used for positive/negative tests
Sample Scenario: Testing Objective
What We Need to Test
13. • Defined within test class
• Returns single callout
response
• WebServiceMock for WSDL
based SOAP callouts
• HttpCalloutMock for testing
Http callouts
• Defined by content of text
file in Static Resource
• Returns response for a
single endpoint
• Similar to
StaticResourceCalloutMock
• Static Resource contains
response for multiple
endpoints
WebServiceMock and
HttpCalloutMock Interfaces
StaticResourceCalloutMock
MultiStaticResourceCalloutMo
ck
Documentation: bit.ly/df15mock3Documentation: bit.ly/df15mock1 Documentation: bit.ly/df15mock2
Options for Testing HTTP Callouts
Out-of-the-box Tools
14. • Defined within test class
• Returns single callout
response
• WebServiceMock for WSDL
based SOAP callouts
• HttpCalloutMock for testing
Http callouts
• Defined by content of text
file in Static Resource
• Returns response for a
single endpoint
• Similar to
StaticResourceCalloutMock
• Static Resource contains
response for multiple
endpoints
WebServiceMock and
HttpCalloutMock Interfaces
StaticResourceCalloutMock
MultiStaticResourceCalloutMo
ck
Documentation: bit.ly/df15mock3Documentation: bit.ly/df15mock1 Documentation: bit.ly/df15mock2
Options for Testing HTTP Callouts
Out-of-the-box Tools
15. • Not “the” test, but is @test
• Called by test class methods
• Returns “mock” responses
• Sets up header, body, and status code
HttpCalloutMock Interface
Part 1: Mock Responder Class
17. • Test class for class making callout (part 1)
• Utilizes Mock Responder Class (part 2)
• Respond from callout comes from responder class (part 2)
HttpCalloutMock Interface
Part 2: Test Coverage
20. • Defined within test class
• Returns single callout
response
• WebServiceMock for WSDL
based SOAP callouts
• HttpCalloutMock for testing
Http callouts
• Defined by content of text
file in Static Resource
• Returns response for a
single endpoint
• Similar to
StaticResourceCalloutMock
• Static Resource contains
response for multiple
endpoints
WebServiceMock and
HttpCalloutMock Interfaces
StaticResourceCalloutMock
MultiStaticResourceCalloutMo
ck
Documentation: bit.ly/df15mock3Documentation: bit.ly/df15mock1 Documentation: bit.ly/df15mock2
Options for Testing HTTP Callouts
Out-of-the-box Tools
21. StaticResourceCalloutMock
Part 1: The static resource
• Only contains JSON text
• Can’t be a zipped static resource w/ multiple files
• mock.setStaticResource(‘Name of Zip’,’File in Zip’)
22. StaticResourceCalloutMock
Part 2: Test coverage
• Slightly different from last example
• No separate class; defined within coverage
• StaticResourceCalloutMock object instead of class with HttpCalloutMock interface
24. • Defined within test class
• Returns single callout
response
• WebServiceMock for WSDL
based SOAP callouts
• HttpCalloutMock for testing
Http callouts
• Defined by content of text
file in Static Resource
• Returns response for a
single endpoint
• Similar to
StaticResourceCalloutMock
• Static Resource contains
response for multiple
endpoints
WebServiceMock and
HttpCalloutMock Interfaces
StaticResourceCalloutMock
MultiStaticResourceCalloutMo
ck
Documentation: bit.ly/df15mock3Documentation: bit.ly/df15mock1 Documentation: bit.ly/df15mock2
Options for Testing HTTP Callouts
Out-of-the-box Tools
25. • Two methods making callouts
• One method using both
MultiStaticResourceCalloutMock
Part 1: Modified Scenario
26. • Similar to StaticResourceCalloutMock
• Define multiple endpoints
• Each has own Static Resource
• Still no Zip file
MultiStaticResourceCalloutMock
Part 2: Test Coverage
Static Resource: Example3_bar1 Static Resource: Example3_bar2
27. MultiStaticResourceCalloutMock
Part 2: Test Coverage
1. New MultiStaticResourceCalloutMock()
2. Set endpoint based resources
3. Set mock
4. Invoke callouts
5. Perform assertions
29. • Batch job
• Import of Contacts from remote system
• Remote system has an API
• Two endpoints
• /api/ContactCount
• /api/Contacts
Remote Import via Batch
Overview
30. • /api/ContactCount
• Returns # of Contact records to be imported
• Result can change during span of batch execution
• /api/Contacts
• Returns x number of contacts
• Paginated
• Page=1 – returns 1st 200 records
• Page=2 – returns 2nd 200 records
• …and so on
Remote Import via Batch
Meet the Endpoints
31. 1. Batch is called
2. Start() method
3. Each execute() iteration performs 2 callouts
4. 1st checks total # of records available
5. 2nd imports records
6. End of execute determines if more
records?
7. Execute may run for many iterations
8. If no more records or limits, finish()
9. Restart cycle
10. End
Remote Import via Batch
Batch Flow
33. Limitations
Working with Our Tools
• HttpCalloutMock Interface and StaticResourceMock
• Can only handle one endpoint
• Single response
• Single setup prior to invoking actual callouts
• MultiStaticResourceCalloutMock
• Handle multiple endpoints
• Single response for each
• Single setup prior to invoking actual callouts
34. Problems
Continued…
• Challenge
• Use one or more standard tool
• Extend the usage
• Create queue of expected responses per endpoint
• Consider re-usability
35. • MakeCallouts Method
• Loops 10x
• Builds string of results
• ContactCount Method
• Makes Callout
• Contacts Method
• Makes callout
• Page Parameter
Building the Problem
Example4_CalloutClass.apxc
public class Example4_CalloutClass {
// Method to simulate all the callouts in our batch flow
public static string MakeCallouts() {
// Property to return
string results = '';
// Let's call each resource 10x and...
for (integer i = 0; i < 10; i++) {
// ...add to results string this Count's response's body
results += 'Count (' + i + '): ' + CalloutContactCount().getBody() + 'rn';
// ...add to results string this Contact response's body
results += 'Contacts (' + i + '): ' + CalloutContacts(i).getBody() + 'rn';
}
// Return concatenated string of results
return results;
36. • ResponseMap
• By method
• By endpoint
• List of responses
• Respond
• Verify request
• Prepare response
• Discard
• Resp Class
Building the Solution
TestCalloutResponseGenerator.apxc
@isTest
global class TestCalloutResponseGenerator implements HttpCalloutMock {
// Property and getter (semi init'd) to pair method --> endpoint --> list of responses
private static map<string, map<string, list<resp>>> ResponseMap;
public static map<string, map<string, list<resp>>> getResponseMap() {
if (ResponseMap == null) {
ResponseMap = new map<string, map<string, list<resp>>>();
// For each setMethod() method type, pre-pop. w/ empty map
for (string method :new list<string>{'GET','PUT','POST','DELETE','HEAD','TRACE'})
ResponseMap.put(method, new map<string, list<resp>>());
}
return ResponseMap;
}
// Required respond() method for HttpCalloutMock
public HttpResponse Respond(HttpRequest req) {
37. • Body (JSON)
• Status (success)
• StatusCode
• Discard
Building the Solution
TestCalloutResponseGenerator.Resp
// Class to hold details of response from within test methods
public class Resp {
public string body { get; set; }
public string status { get; set; }
public integer statusCode { get; set; }
public boolean discard { get; set; }
public Resp(string body, string status, integer statusCode, boolean discard) {
this.body = body;
this.status = status;
this.statusCode = statusCode;
this.discard = discard;
}
}
38. • ResponseMap
• By method
• By endpoint
• List of responses
Building the Solution
TestCalloutResponseGenerator.getResponseMap()
// Property to pair method --> endpoint --> list of responses
private static map<string, map<string, list<resp>>> ResponseMap;
// Getter to return or prepare a semi init'd response map
public static map<string, map<string, list<resp>>> getResponseMap() {
if (ResponseMap == null) {
ResponseMap = new map<string, map<string, list<resp>>>();
// For each setMethod() method type, pre-pop. w/ empty map
for (string method :new list<string>{'GET','PUT','POST','DELETE','HEAD','TRACE'})
ResponseMap.put(method, new map<string, list<resp>>());
}
return ResponseMap;
}
39. • Respond
• Verify request
• Prepare response
• Discard
Building the Solution
TestCalloutResponseGenerator.Respond(HttpRequest req)
// Required respond() method for HttpCalloutMock
public HttpResponse Respond(HttpRequest req) {
// Property for returned response
HttpResponse res = new HttpResponse();
// Ensure HttpRequest is valid
if (req != null && !string.isBlank(req.getMethod()) && !string.isBlank(req.getEndPoint())) {
// Verify the Response map contains the req's method and endpoint
if (getResponseMap().containsKey(req.getMethod()) &&
getResponseMap().get(req.getMethod()).containsKey(req.getEndpoint())
) {
// Instantiate a list of the method/endpoint's response bodies
list<resp> respList =
getResponseMap().get(req.getMethod()).get(req.getEndpoint());
// If there's at least one, use it - otherwise, output an error
if (!respList.isEmpty()) {
40. • Setup ResponseMap
• Shortcut Explanation
• Contacts
• ContactCount
• Discard
• Set mock
• Invoke Callout
Testing the Solution
Example4_TestCalloutClass.TestWithPattern()
@isTest
public class Example4_TestCalloutClass {
public static testMethod void TestWithPattern() {
/* The below is just a shortcut for the demo. Instead of this 10x (1 per page):
TestCalloutResponseGenerator.getResponseMap().get('GET').put(
'/api/Contacts?page=1',
new list<TestCalloutResponseGenerator.Resp> {
new TestCalloutResponseGenerator.Resp(
'{"Contacts":"data...page 1'"}',
'success',
200,
false
)
}
);
*/
// Temporary collection to hold looped results (for demo, we don't care about actual data,
41. Testing the Solution
Example4_TestCalloutClass.TestWithPattern()
// Temporary collection to hold looped results (for demo, we don't care about actual data, just proof of concept)
map<string, list<TestCalloutResponseGenerator.Resp>> pagedResponses =
new map<string, list<TestCalloutResponseGenerator.Resp>>();
// Create a dummy response for Contact callout for our "10" pages of contacts
for (integer i = 0; i < 10; i++) {
// Each loop = 1 page
pagedResponses.put('/api/Contacts?page=' + i, new list<TestCalloutResponseGenerator.Resp>{
new TestCalloutResponseGenerator.Resp(
'{"Contacts":"data...' + i + '"}',
'success',
200,
true)
});
}
// Add all of the contact responses to the response map
TestCalloutResponseGenerator.getResponseMap().put('GET', pagedResponses);
43. Testing the Solution
TestCalloutClass
1. Count or Contact callout
2. # of loop iteration
3. Count data 10, 12, 12, …
1. Use 1st, discard
2. Use 2nd, don’t discard
4. Contact data increments
1. Provided per page response