Kevin Poorman presented 10 principles of Apex testing. The principles included using asserts to validate expected behavior, using StartTest and StopTest to reset limits, writing both positive and negative tests, testing with different user profiles and permission sets, generating own test data rather than using real data, using helper libraries to facilitate testing, mocking external services to enable unit testing, writing code in a testable way, and leveraging continuous integration to catch failing tests early. Continuous integration was said to help with multiple developers working in parallel and keeping aware of test coverage.
In this first installment of our Secure Salesforce Development webinar series members of the Salesforce Trust team will introduce the core concepts behind developing secure applications on the Salesforce platform using Apex and Visualforce. We’ll walk through creation and development of a simple, on-platform app and examine common security vulnerabilities that developers unintentionally introduce to their applications. After discussing the danger of these vulnerabilities and demonstrating their impact we’ll go in depth into how to avoid introducing them in your code, how to review existing code and find them, and how to fix them.
In this session, security experts from Salesforce will show you how to avoid common security pitfalls while developing applications using Apex and Visualforce.
This second installment of our secure development series continues development of the simple on-platform app created in part one by examining how vulnerabilities present themselves. After discussing these vulnerabilities and demonstrating their impact, we’ll show how to avoid introducing them in your code, how to review existing code to locate issues, and how to fix them to provide more secure apps.
In this exclusive webinar you’ll learn about:
- Common VisualForce vulnerabilities
- XSS (Cross-site Scripting)
- Open Redirect
- CSRF (Cross-Site Request Forgery)
Table of Contents:
01:19 - Forward Looking Statement
02:24 - Agenda
03:00 - FourZip App Part 2
05:05 - Cross Site Scripting
27:15 - Open Redirect
37:22 - CSRF - Cross-Site Request Forgery
44:06 - Session Summary
45:50 - Live Q&A
Want to improve the performance of your Lightning components and applications? This webinar is for you! Whether you are an experienced Lightning component developer or just starting, you’ll learn a series of best practices you can immediately implement to make your components load faster, run faster, and access data more efficiently.
Part of what truly makes a platform is an ability to integrate with third party devices, servers and software. Join Ami Assayag and Kirk Steffke from CRM Science and Developer Evangelist Josh Birk as they breakdown examples of using Apex for integration solutions. Apex has robust methods for handling both inbound requests into Salesforce and outbound calls into third party systems. This webinar will break down how Apex can be used in these cases as well as how to test the code once it is up and running.
Key Takeaways
- How Apex fits into an integration solution
- Using Apex to create custom endpoints
- Handling outbound calls with Apex
- How to achieve test coverage with mock interfaces
Intended Audience
Developers with Apex experience looking to integrate with either existing API’s or expanding the functionality of Salesforce API’s.
Salesforce API Series: Integrating Applications with Force.com WebinarSalesforce Developers
Force.com APIs allow you to easily integrate back-office applications with Force.com while leveraging existing platform choices for systems like ERP, Financials and other custom applications. This webinar, the first in a series covering all Salesforce APIs, focuses on the SOAP and REST APIs, and will present asynchronous integration options, showing how they can be used to access data in Force.com and connect other applications to Force.com. Future webinars will focus on the APIs specific to Service Cloud, Collaboration, Metadata and the Tooling API.
Watch this webinar to learn how to make basic API calls using Java, and implement inbound and outbound calls to and from Force.com.
Key Takeaways
Learn about the various API options available to you when integrating Force.com with other applications.
See how the basic SOAP and REST APIs work in an application.
Implement a commonly used pattern to integrate information from Force.com to an external system.
Intended Audience
Force.com developers or Integration developers and architects with a working understanding of Web Services.
Lightning Web Components give any JavaScript developer a modern, web standards-based path to building apps and experiences on the Lightning Platform.
In the second episode of our five part webinar series on Lightning Web Components, we will show you how to access data from the Salesforce org, get record data, create records and handle errors using Lightning Web Components. In this webinar you’ll learn all about Lightning Data Service, reactive wire service and Lightning App Builder.
In this first installment of our Secure Salesforce Development webinar series members of the Salesforce Trust team will introduce the core concepts behind developing secure applications on the Salesforce platform using Apex and Visualforce. We’ll walk through creation and development of a simple, on-platform app and examine common security vulnerabilities that developers unintentionally introduce to their applications. After discussing the danger of these vulnerabilities and demonstrating their impact we’ll go in depth into how to avoid introducing them in your code, how to review existing code and find them, and how to fix them.
In this session, security experts from Salesforce will show you how to avoid common security pitfalls while developing applications using Apex and Visualforce.
This second installment of our secure development series continues development of the simple on-platform app created in part one by examining how vulnerabilities present themselves. After discussing these vulnerabilities and demonstrating their impact, we’ll show how to avoid introducing them in your code, how to review existing code to locate issues, and how to fix them to provide more secure apps.
In this exclusive webinar you’ll learn about:
- Common VisualForce vulnerabilities
- XSS (Cross-site Scripting)
- Open Redirect
- CSRF (Cross-Site Request Forgery)
Table of Contents:
01:19 - Forward Looking Statement
02:24 - Agenda
03:00 - FourZip App Part 2
05:05 - Cross Site Scripting
27:15 - Open Redirect
37:22 - CSRF - Cross-Site Request Forgery
44:06 - Session Summary
45:50 - Live Q&A
Want to improve the performance of your Lightning components and applications? This webinar is for you! Whether you are an experienced Lightning component developer or just starting, you’ll learn a series of best practices you can immediately implement to make your components load faster, run faster, and access data more efficiently.
Part of what truly makes a platform is an ability to integrate with third party devices, servers and software. Join Ami Assayag and Kirk Steffke from CRM Science and Developer Evangelist Josh Birk as they breakdown examples of using Apex for integration solutions. Apex has robust methods for handling both inbound requests into Salesforce and outbound calls into third party systems. This webinar will break down how Apex can be used in these cases as well as how to test the code once it is up and running.
Key Takeaways
- How Apex fits into an integration solution
- Using Apex to create custom endpoints
- Handling outbound calls with Apex
- How to achieve test coverage with mock interfaces
Intended Audience
Developers with Apex experience looking to integrate with either existing API’s or expanding the functionality of Salesforce API’s.
Salesforce API Series: Integrating Applications with Force.com WebinarSalesforce Developers
Force.com APIs allow you to easily integrate back-office applications with Force.com while leveraging existing platform choices for systems like ERP, Financials and other custom applications. This webinar, the first in a series covering all Salesforce APIs, focuses on the SOAP and REST APIs, and will present asynchronous integration options, showing how they can be used to access data in Force.com and connect other applications to Force.com. Future webinars will focus on the APIs specific to Service Cloud, Collaboration, Metadata and the Tooling API.
Watch this webinar to learn how to make basic API calls using Java, and implement inbound and outbound calls to and from Force.com.
Key Takeaways
Learn about the various API options available to you when integrating Force.com with other applications.
See how the basic SOAP and REST APIs work in an application.
Implement a commonly used pattern to integrate information from Force.com to an external system.
Intended Audience
Force.com developers or Integration developers and architects with a working understanding of Web Services.
Lightning Web Components give any JavaScript developer a modern, web standards-based path to building apps and experiences on the Lightning Platform.
In the second episode of our five part webinar series on Lightning Web Components, we will show you how to access data from the Salesforce org, get record data, create records and handle errors using Lightning Web Components. In this webinar you’ll learn all about Lightning Data Service, reactive wire service and Lightning App Builder.
Description
Visualforce is a powerful web-based framework that lets you quickly develop sophisticated, custom UIs for Force.com desktop and mobile apps. Using native Visualforce markup and standard Web development technologies like HTML5, CSS, JavaScript, and jQuery, you can rapidly build rich UIs for any app.
In this webinar, we will go beyond the basics of Visualforce, and show you how to make your pages lean and fast, to provide you users with an awesome experience, resulting in high adoption rates. We will also focus on best practices and tips to help you improve page efficiency.
In addition to the above, we will also show you how to build custom components, ones that can be reused across several Visualforce pages and applications.
Key Takeaways
::Get thorough knowledge about Viewstate, JavaScript Remoting, Asynchronous Apex and Streaming API.
::Get up to speed with Visualforce components, and see examples of advanced custom Visualforce components in action.
::Discover how to use strongly typed attributes to parameterize component.
::Learn how to incorporate presentation, data and logic.
Intended Audience
This session is tailored for experienced developers who are already familiar with the Visualforce framework.
Recommended Resources
https://developer.salesforce.com/events/webinars/advanced_visualforce_salesforce1
The Service Cloud portfolio provides a number of wholly cloud-based applications designed specifically in mind to integrate with your enterprise and deliver a rich 360-degree customer profile. At its basic core, the Service Cloud Console is an Application Framework which can be leveraged to:
Present all relevant details in context in a single page presentation
Integrate with 3rd party applications
Connect with customers via telephony, Live Agent Web chat, and Knowledge integration
Push information to your users as your data changes
Watch this webinar to learn about the Service Cloud Integration toolkit as well as other declarative and programmatic options available to customize and get the most from the Service Cloud Console.
Key Takeaways
Learn how to integrate your legacy web applications with the Service Cloud Console
Learn how to personalize the user experience with screen pops, launching primary tabs and subtabs, and setting tab titles
Extend functionality with Visualforce and custom console components
Intended Audience
Force.com Developers, Technical Leads, Architects, Application Directors familiar with the Service Cloud, Visualforce and JavaScript
Cross-site scripting, SOQL injection, Open Redirect. Even if you've heard of these security vulnerabilities, you might not understand exactly how they work. Join two Salesforce security engineers as they explain how these common web application vulnerabilities manifest in your Force.com code and show you with simple demo code how to banish these flaws for good.
In this webinar, we'll share how you can leverage the tools and best practices available to promote healthy Application Lifecycle Management.
Learn about the latest advancements we've made in our Sandbox environments, metadata API, deployments, namespaces and source control management, how the brand new Apex Debugger extends the Force.com IDE, and how these updates can be leveraged to enhance your development efforts and transformation.
Description
In this webinar we will introduce you to Apex, and then walk you through the process of writing and deploying a basic trigger in your development environment.
This series serves as an Introduction to Apex for Salesforce Administrators with no programming background. This is the first in a 3-part series with David Liu and LeeAnne Templeman. David Liu is the creator of sfdc99.com, an intro to Apex exercise guide for all Salesforce Admins. David is a self-taught Salesforce MVP who began his path as a marketer and is now the Salesforce Technical Architect for Google. He will share some of his own learning path, as well as tips and tricks on how to become a Salesforce developer.
Key Takeaways
See how quickly you can pick up the Force.com programming language and build triggers on your own!
Learn what a test class is, and how to write, modify and deploy a basic trigger
Understand when to use Apex and when to use core Salesforce tools like workflows and approvals
Expand the automation capabilities in your Salesforce environment to increase adoption and data quality
Understand core terms and development processes
Series
Targeted Audience: Salesforce Admins with experience developing point-and-click applications on the Force.com platform.
Related Resources
Apex Overview Page
Apex Developer Guide
Apex Workbook
sfdc99.com Chapter 1: Write Your First Trigger from Start to Finish!
Head First Java
Facing complex business automation requirements? Don't worry, we've got you covered! Attend this session to get hands-on with the App Cloud's powerful process automation tools: Process Builder, Flow, and Apex Code.
Do you want to create communities to help your organization provide stellar customer service, connect your customers together or increase employee productivity?
Learn how you can customize Salesforce Community Cloud to fit your needs with the Lightning Bolt framework, Lightning Components and Community Builder.
Description
Part of what truly makes a platform is an ability to integrate with third party devices, servers and software. Join Ami Assayag and Kirk Steffke from CRM Science and Developer Evangelist Josh Birk as they breakdown examples of using Apex for integration solutions. Apex has robust methods for handling both inbound requests into Salesforce and outbound calls into third party systems. This webinar will break down how Apex can be used in these cases as well as how to test the code once it is up and running.
Key Takeaways
- How Apex fits into an integration solution
- Using Apex to create custom endpoints
- Handling outbound calls with Apex
- How to achieve test coverage with mock interfaces
Intended Audience
Developers with Apex experience looking to integrate with either existing API’s or expanding the functionality of Salesforce API’s.
Join us for a deep dive into the presentation layer of the Lightning Experience. Learn the core CSS principles and design patterns behind the Salesforce Lightning Design System, and how you can leverage it within your own Lightning Components. But don’t worry, it’s not all CSS. We’ll also discuss adding Javascript for interactive components.
Secure Development on the Salesforce Platform - Part 3Mark Adcock
This webinar covers key topics and best practices on how to securely connect your applications with Salesforce. We will demonstrate Salesforce recommended solutions to securely handle secrets within your application and help you prevent data leaks
You will also learn how to set up a Salesforce Connected App to handle authentication and access control when integrating with Salesforce.
Integrations with the Force.com Platform Using Custom Apex REST ServicesSalesforce Developers
Join us to learn how to create custom Apex REST web services to allow multiple external systems to integrate - more specifically, the architecture of such services to control and sanitize inputs, fully handle internal exception reporting, and return standard outputs that are able to be consumed and handled by any external programmatic solution.
With the Lightning Framework you can build modern apps faster and run them across all your devices. With the Winter ’17 Release, we’ve delivered a number of enhancements to Lightning to help you build even faster including new Lightning Base Components and Lightning Data Services. Learn about these important new features and more in this must-attend webinar.
- Accessing data more easily and efficiently with the new Lightning Data Service
- Building Lightning Components faster with new Lightning Base Components
- Developing more interactive experiences with new Lightning Quick Actions and the Utility Bar
When building an enterprise solution or creating an app, data often comes from multiple systems, and business processes frequently cross application boundaries.
Salesforce offers a rich library of programmatic and point-and-click integration tools to customize business processes that span multiple application systems. In this webinar, we will survey the many integration options and technologies available in Salesforce, including newer API and integration features.
This webinar is the first in a series that will explore several ways to integrate systems and services with Salesforce.
Force.com lets developers rapidly create and deploy trusted cloud apps that are secure and scalable. Part 1 of this webinar series gave you the platform overview, in Part 2 you learn how to customize your app using the foundational features of Force.com.
- Key Takeaways
- Part 1 recap with demo
- Get an understanding of Visualforce Pages and Standard Controllers
- See basic uses of Controller Extensions and Custom Controllers
- Writing test classes for unit testing to improve code coverage
Intended Audience
This session is geared towards Developers (any programming background) who wish to learn about Force.com basics and to create apps faster with code on Force.com platform
The Salesforce object model and the SOQL query language form the foundation of working with Salesforce data. While most developers are SQL-literate, there are small but important distinctions between SOQL and SQL. In this webinar, developers new to Salesforce will come to understand these differences, jumpstarting their Salesforce developer success.
Join us to learn how to significantly reduce the time needed to write and maintain Selenium tests by using page flows to encapsulate the navigational elements in your application. We'll show you how common, multi-page UI actions in Selenium tests can be abstracted into page flows. With a page flow, developers can cut to the chase in a testing scenario, bypassing the setup often needed to navigate to the beginning of your testable action. Leave knowing what you need to add a high value, low maintenance Selenium test suite to your arsenal.
So you have made the decision to move to Lightning, but what does that mean for your Visualforce pages? Join us to find out what works and what doesn’t, strategies for the things you might need to fix, and finally, how to update your pages with the Salesforce Lightning Design System, and much more.
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.
Lightning allows developers to rapidly develop highly interactive applications with Lightning Components. In this webinar, we will show you the best practices to build a single page application by using features from the Lightning Component framework.
Description
Visualforce is a powerful web-based framework that lets you quickly develop sophisticated, custom UIs for Force.com desktop and mobile apps. Using native Visualforce markup and standard Web development technologies like HTML5, CSS, JavaScript, and jQuery, you can rapidly build rich UIs for any app.
In this webinar, we will go beyond the basics of Visualforce, and show you how to make your pages lean and fast, to provide you users with an awesome experience, resulting in high adoption rates. We will also focus on best practices and tips to help you improve page efficiency.
In addition to the above, we will also show you how to build custom components, ones that can be reused across several Visualforce pages and applications.
Key Takeaways
::Get thorough knowledge about Viewstate, JavaScript Remoting, Asynchronous Apex and Streaming API.
::Get up to speed with Visualforce components, and see examples of advanced custom Visualforce components in action.
::Discover how to use strongly typed attributes to parameterize component.
::Learn how to incorporate presentation, data and logic.
Intended Audience
This session is tailored for experienced developers who are already familiar with the Visualforce framework.
Recommended Resources
https://developer.salesforce.com/events/webinars/advanced_visualforce_salesforce1
The Service Cloud portfolio provides a number of wholly cloud-based applications designed specifically in mind to integrate with your enterprise and deliver a rich 360-degree customer profile. At its basic core, the Service Cloud Console is an Application Framework which can be leveraged to:
Present all relevant details in context in a single page presentation
Integrate with 3rd party applications
Connect with customers via telephony, Live Agent Web chat, and Knowledge integration
Push information to your users as your data changes
Watch this webinar to learn about the Service Cloud Integration toolkit as well as other declarative and programmatic options available to customize and get the most from the Service Cloud Console.
Key Takeaways
Learn how to integrate your legacy web applications with the Service Cloud Console
Learn how to personalize the user experience with screen pops, launching primary tabs and subtabs, and setting tab titles
Extend functionality with Visualforce and custom console components
Intended Audience
Force.com Developers, Technical Leads, Architects, Application Directors familiar with the Service Cloud, Visualforce and JavaScript
Cross-site scripting, SOQL injection, Open Redirect. Even if you've heard of these security vulnerabilities, you might not understand exactly how they work. Join two Salesforce security engineers as they explain how these common web application vulnerabilities manifest in your Force.com code and show you with simple demo code how to banish these flaws for good.
In this webinar, we'll share how you can leverage the tools and best practices available to promote healthy Application Lifecycle Management.
Learn about the latest advancements we've made in our Sandbox environments, metadata API, deployments, namespaces and source control management, how the brand new Apex Debugger extends the Force.com IDE, and how these updates can be leveraged to enhance your development efforts and transformation.
Description
In this webinar we will introduce you to Apex, and then walk you through the process of writing and deploying a basic trigger in your development environment.
This series serves as an Introduction to Apex for Salesforce Administrators with no programming background. This is the first in a 3-part series with David Liu and LeeAnne Templeman. David Liu is the creator of sfdc99.com, an intro to Apex exercise guide for all Salesforce Admins. David is a self-taught Salesforce MVP who began his path as a marketer and is now the Salesforce Technical Architect for Google. He will share some of his own learning path, as well as tips and tricks on how to become a Salesforce developer.
Key Takeaways
See how quickly you can pick up the Force.com programming language and build triggers on your own!
Learn what a test class is, and how to write, modify and deploy a basic trigger
Understand when to use Apex and when to use core Salesforce tools like workflows and approvals
Expand the automation capabilities in your Salesforce environment to increase adoption and data quality
Understand core terms and development processes
Series
Targeted Audience: Salesforce Admins with experience developing point-and-click applications on the Force.com platform.
Related Resources
Apex Overview Page
Apex Developer Guide
Apex Workbook
sfdc99.com Chapter 1: Write Your First Trigger from Start to Finish!
Head First Java
Facing complex business automation requirements? Don't worry, we've got you covered! Attend this session to get hands-on with the App Cloud's powerful process automation tools: Process Builder, Flow, and Apex Code.
Do you want to create communities to help your organization provide stellar customer service, connect your customers together or increase employee productivity?
Learn how you can customize Salesforce Community Cloud to fit your needs with the Lightning Bolt framework, Lightning Components and Community Builder.
Description
Part of what truly makes a platform is an ability to integrate with third party devices, servers and software. Join Ami Assayag and Kirk Steffke from CRM Science and Developer Evangelist Josh Birk as they breakdown examples of using Apex for integration solutions. Apex has robust methods for handling both inbound requests into Salesforce and outbound calls into third party systems. This webinar will break down how Apex can be used in these cases as well as how to test the code once it is up and running.
Key Takeaways
- How Apex fits into an integration solution
- Using Apex to create custom endpoints
- Handling outbound calls with Apex
- How to achieve test coverage with mock interfaces
Intended Audience
Developers with Apex experience looking to integrate with either existing API’s or expanding the functionality of Salesforce API’s.
Join us for a deep dive into the presentation layer of the Lightning Experience. Learn the core CSS principles and design patterns behind the Salesforce Lightning Design System, and how you can leverage it within your own Lightning Components. But don’t worry, it’s not all CSS. We’ll also discuss adding Javascript for interactive components.
Secure Development on the Salesforce Platform - Part 3Mark Adcock
This webinar covers key topics and best practices on how to securely connect your applications with Salesforce. We will demonstrate Salesforce recommended solutions to securely handle secrets within your application and help you prevent data leaks
You will also learn how to set up a Salesforce Connected App to handle authentication and access control when integrating with Salesforce.
Integrations with the Force.com Platform Using Custom Apex REST ServicesSalesforce Developers
Join us to learn how to create custom Apex REST web services to allow multiple external systems to integrate - more specifically, the architecture of such services to control and sanitize inputs, fully handle internal exception reporting, and return standard outputs that are able to be consumed and handled by any external programmatic solution.
With the Lightning Framework you can build modern apps faster and run them across all your devices. With the Winter ’17 Release, we’ve delivered a number of enhancements to Lightning to help you build even faster including new Lightning Base Components and Lightning Data Services. Learn about these important new features and more in this must-attend webinar.
- Accessing data more easily and efficiently with the new Lightning Data Service
- Building Lightning Components faster with new Lightning Base Components
- Developing more interactive experiences with new Lightning Quick Actions and the Utility Bar
When building an enterprise solution or creating an app, data often comes from multiple systems, and business processes frequently cross application boundaries.
Salesforce offers a rich library of programmatic and point-and-click integration tools to customize business processes that span multiple application systems. In this webinar, we will survey the many integration options and technologies available in Salesforce, including newer API and integration features.
This webinar is the first in a series that will explore several ways to integrate systems and services with Salesforce.
Force.com lets developers rapidly create and deploy trusted cloud apps that are secure and scalable. Part 1 of this webinar series gave you the platform overview, in Part 2 you learn how to customize your app using the foundational features of Force.com.
- Key Takeaways
- Part 1 recap with demo
- Get an understanding of Visualforce Pages and Standard Controllers
- See basic uses of Controller Extensions and Custom Controllers
- Writing test classes for unit testing to improve code coverage
Intended Audience
This session is geared towards Developers (any programming background) who wish to learn about Force.com basics and to create apps faster with code on Force.com platform
The Salesforce object model and the SOQL query language form the foundation of working with Salesforce data. While most developers are SQL-literate, there are small but important distinctions between SOQL and SQL. In this webinar, developers new to Salesforce will come to understand these differences, jumpstarting their Salesforce developer success.
Join us to learn how to significantly reduce the time needed to write and maintain Selenium tests by using page flows to encapsulate the navigational elements in your application. We'll show you how common, multi-page UI actions in Selenium tests can be abstracted into page flows. With a page flow, developers can cut to the chase in a testing scenario, bypassing the setup often needed to navigate to the beginning of your testable action. Leave knowing what you need to add a high value, low maintenance Selenium test suite to your arsenal.
So you have made the decision to move to Lightning, but what does that mean for your Visualforce pages? Join us to find out what works and what doesn’t, strategies for the things you might need to fix, and finally, how to update your pages with the Salesforce Lightning Design System, and much more.
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.
Lightning allows developers to rapidly develop highly interactive applications with Lightning Components. In this webinar, we will show you the best practices to build a single page application by using features from the Lightning Component framework.
As an Apex developer, you can harness testing as a way of improving software quality. Every piece of code you write needs coverage in order to push it into production. Join us as we cover the ways you can set up your org for successful and painless test development. You'll learn common testing patterns, how to use test data factories and mocks, and learn best practices for various types of tests, including callout integration.
This slide deck is from the Advanced Apex webinar I presented for Salesforce.com which can be viewed at https://developer.salesforce.com/events/webinars/advanced_apex.
Description:
Whether you are an experienced developer coming to Apex from another language, or an intermediate level Apex developer, this webinar will take you to the next level in programming on the Salesforce and Force.com platform. We will dive deeper into Apex, and guide you through examples of advanced design patterns and techniques, and much more related to Apex on the Salesforce1 platform!
Key Takeaways:
::Programmers familiar with object-oriented languages will be able to learn Apex easily
::Apex can perform a wide range of functions from serving as a controller for Visualforce pages to scheduled tasks in the background.
::Get a deep dive into testing and code coverage on Force.com, and learn some solid best practices and recipes for writing better tests.
Intended Audience:
::Programmers familiar with object-oriented languages, and looking for an deeper dive into Apex
Join us to learn the components required for building a good unit test that will keep your developers and applications from being blindsided, as well as some of the common Apex use cases like controllers and triggers. You'll also see how to handle trickier situations like HTTP callouts and asynchronous processing.
Description
Final installation of the 3 part webinar series! Time to use all the Apex skills you have learned in this series and combine SOQL with Apex to build one glorious trigger.
This series serves as an Introduction to Apex for Salesforce Administrators with no programming background. This is the last in a 3-part series with David Liu and LeeAnne Templeman. David Liu is the creator of sfdc99.com, an intro to Apex exercise guide for all Salesforce Admins. David is a self-taught Salesforce MVP who began his path as a marketer and is now the Salesforce Technical Architect for Google. He will share some of his own learning path, as well as tips and tricks on how to become a Salesforce developer.
Key Takeaways
::Learn the principles of a good test class
::Maintain your data quality by writing a deduping trigger
::Get an outline of the steps to become a Salesforce Developer
Series
Apex for Admins series:
::Get Started with Apex in 30 Minutes!
::Build on the Basics
::Beyond the Basics ← you are here!
Intended Audience
::Salesforce Admins who have begun learning Apex. You should be familiar with basic triggers, Apex classes, and basic Apex.
::Anyone who joined us last week for Apex for Admins: Build on the Basics
::If you missed the previous session, get up to speed with these awesome tutorials from sfdc99.com:
Chapter 2: SOQL: A Beginner’s Guide
Chapter 3: Core Apex Tools
Recommended Resources
https://developer.salesforce.com/en/events/webinars/apex-for-admins-beyond-the-basics?d=70130000000hUks
If you are familiar with object-oriented languages like Java or C#, Apex may be the language you already almost know. Apex is the cloud-based programming language used on the Salesforce1 Platform to take your enterprise applications to the next level. In this webinar, get an introduction to how Apex is similar to other languages, how you can start coding in Apex with just a web browser, and an overview of the many functions Apex can perform for your applications and users.
Key Takeaways
Programmers familiar with object-oriented languages will be able to learn Apex easily
Apex can perform a wide range of functions from serving as a controller for Visualforce pages to scheduled tasks in the background.
Make testing easier and more productive by applying test-driven development strategies to the world of iOS and Objective-C. Join us to learn about the tools that are available, and hear strategies for writing more testable code and robust tests. You'll be ready to take the next step and integrate these strategies into your daily workflow.
Talk given by Marat Vyshegorodtsev and Sergey Gorbaty. Enterprise Security team at Salesforce, in January 2017.
Discusses a set of open source tools that analyze the Apex/VisualForce code and advise on its quality.
Quit Jesting and Test your Lightning Web Components, Phillipe OzilCzechDreamin
This developer session introduces Lightning Web Component testing. It starts with an overview of the testing environment built around the Jest framework. We learn how the environment operates in complete isolation from the Salesforce Platform and lets you run tests locally. We then cover the basics of writing tests with a "Given, When, Then" pattern. We leave you with common patterns and tips for writing efficient tests.
Continuous Integration In The Cloud Final (1)Alexis Williams
Continuous integration of cloud based applications using a combination of technologies: Visual Force, Apex, Selenium, Jenkins, Ant, & YUI test framework
"We'll need an Apex trigger to do that." Sound familiar? Take your advanced Admin skills to the next level by developing Apex triggers to solve complex business requirements that can't be implemented using just the configuration-driven features of Force.com. Join us to learn when and how to write your first Apex trigger, and some best practices for making them effective.
Df14 Building Machine Learning Systems with Apexpbattisson
Slide deck from the Dreamforce 20134 talk "Building Machine Learning Systems with Apex". Includes links to github code repository and contact details for speakers.
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSalesforce Developers
Exploring the code within sample applications is a great way to learn new languages, frameworks, and platforms. That’s why we built the Sample Gallery (https://trailhead.salesforce.com/sample-gallery), a collection of Salesforce Customer 360 Platform reference applications that demonstrate examples of what you can create and how to build it. In this interactive webinar, we introduce you to a few Sample Apps and show you how to make the best use of them in your day-to-day development projects.
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceSalesforce Developers
We all want the Salesforce Lightning Experience to be fast- but how do we define fast, and how do we make it even faster? When you’re building a UI, everything you add to the page affects performance, and to make load times faster and perform the way users expect, we need to treat speed as an essential design feature. In this presentation, you’ll learn how to measure performance, learn a few tips on how to maximize performance, and take responsibility for your feature’s performance from design to production.
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
GitHub repo: https://github.com/adityanaag3/aura2lwc
Lightning Web Components (LWC) give any JavaScript developer a modern, web standards-based path to building apps and experiences on the Salesforce Platform.
In this live coding session, you’ll learn how to first evaluate if an existing Aura Component needs to be converted, then convert it to LWC using the latest features of Salesforce Extensions for VS Code. We demonstrate conversion to LWC by walking through various components of a real world Aura Component - including input and output, Tables, Forms, and more.
In this live coding session we:
- Convert Aura Components to LWC
- Leverage the latest IDE features
- Share implementation best practices
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.
In the fourth episode of our five part series on Lightning Web Components, we show you how static resources and custom JavaScript are used with Lightning Web Components. You’ll learn how to use external APIs in conjunction with Lightning Locker to secure your JavaScript code. And finally, we’ll demonstrate how you can test your Lightning Web Components using Jest.
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.
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.
Using Salesforce DX and its suite of offerings can significantly increase your development productivity.
Join this webinar to learn more about source control, scratch orgs, CLI, Metadata Coverage, VS Code, and Unlocked Packages. We will even do a live demo on continuous delivery using Salesforce DX.
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.
With the MuleSoft Anypoint Platform, you can build scalable data integrations and flows across any application, data source, and device - whether in the cloud or on-premise. The platform provides a suite of out-of-the-box connectors that work across any system, and you can customize them to whatever you need with minimal code. This means you can integrate and deploy innovative, robust customer apps even faster. Join this webinar, learn the basics of the Anypoint Platform, and see how it works with Salesforce and any of your third party systems.
This webinar focuses on what’s available for app delivery and development lifecycles on the Salesforce platform. We’ll walk through a real-life scenario that spans VS Code, the Salesforce CLI, sandboxes, scratch orgs, and packaging. Join us and learn patterns and considerations that you can immediately use to modernize your development using Salesforce DX.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
3. #forcewebinar
Safe Harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if
any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-
looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of
product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of
management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments
and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our
service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of
growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and
any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain,
and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling
non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the
financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on
Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of
the Investor Information section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may
not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently
available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
4. #forcewebinar
Go Social!
Salesforce Developers
+Salesforce Developers
Salesforce Developers
Salesforce Developers The video will be posted to
YouTube & the webinar recap
page (same URL as registration).
This webinar is being recorded!
@salesforcedevs / #forcewebinar
So make sure to
leave comments
on YouTube
5. #forcewebinar
▪ Don’t wait until the end to ask your question!
– Technical support will answer questions starting now.
▪ Respect Q&A etiquette
– Please don’t repeat questions. The support team is working
their way down the queue.
▪ Stick around for live Q&A at the end
– Speakers will tackle more questions at the end, time-
allowing. If no one asks questions, Kevin will.
▪ Head to Developer Forums
– More questions? Visit developer.salesforce.com/forums
Have Questions?
8. #forcewebinar
Why we test?
Tests provide assurance of functionality
Tests reduce cost of change
Tests encourage modular, reusable code
Tests help identify engineering and architectural bugs
Tests help document expected behavior
Tests + Code = less likely to produce bugs
9. #forcewebinar
Principle #1, Use Asserts
A test without Assert methods isn’t a test, it’s code
execution
Three Assert methods built-in
– System.Assert(boolean-expression, ‘friendly message’)
– System.AssertEquals(expect, actual, ‘friendly message’)
– System.AssertNotEquals(expected, actual, ‘friendly message)
Every test method should include at least one assertion
10. #forcewebinar
Principle #1, Use Asserts
You can write your own assert methods!
@isTest
Public class customAssertions{
public class customAssertionException extends Exception{}
Public Boolean DuplicateAccount(Account a, Account b){
// … compare accounts
if(duplicate != true) {
Throw new customAssertionException(‘whoa, it’s not the
same’);
}
return true;
}
}
11. #forcewebinar
Principle #2, use startTest and stopTest
Test.startTest() and Test.stopTest() help facilitate
testing.
startTest() resets DML, CPU Time and other governor
limits, ensuring any limits you hit come from your tested
code!
stopTest() Forces asynchronous code to complete.
12. #forcewebinar
Principle #2, use startTest and stopTest
General pattern is to
– Create your test data
– Start the test
– Use that test data within your tested method
– End the Test
– Assert your code works as expected
13. #forcewebinar
Principle #3, Positive Tests
Write ‘Positive Tests’
Positive tests test the expected behavior
Lets talk about multiple expected behaviors
Not just happy path testing
16. #forcewebinar
Principle #4, Negative Tests
Negative tests prove that your code properly handles
exceptions and errors.
The general pattern is to call your method within a
try/catch block in the test. Since you expect an
exception you’ll catch it in the catch block
Less intuitive but more powerful!
17. #forcewebinar
Principle #4, Negative Tests
Public class exampleCode {
Public class exampleCodeException{}
Public Integer division(Integer one, Integer two){
if(two == 0) {
Throw new exampleCodeException(‘Dividing by zero makes kittens
cry’);
}
return one / two;
}
}
19. #forcewebinar
Principle #5, User Tests
User based tests prove your security model
Test with Users of different Roles / Profiles and
Permission sets!
The pattern works like this: Create a user with a given
profile. As needed assign permission sets. Test both
positive and negative users.
20. #forcewebinar
Principle #5, User Tests
Public class exampleCode {
Public class exampleCodeException{}
Public Integer getBankAccount(Account a){
return a.SuperSecretBankAccountNum__c;
}
}
21. #forcewebinar
Principle #5, User Tests Positive
@isTest
private class exampleCode_Tests {
@isTest static void test_getBankAccount_Positive() {
exampleCode drWho = new exampleCode();
User u = AwesomeTestLib.getUserWithProfile(‘JediProfile’);
Account a = (Account)TestFactory.createSObject(new Account());
Integer result;
System.runAs(u){
Test.startTest();
result = drWho.getBankAccount(a);
Test.stopTest();
}
System.assertNotEquals(result, null,
‘Expected this user to have access to bank #’);
}
22. #forcewebinar
Principle #5, User Tests - Negative
@isTest
private class exampleCode_Tests {
@isTest static void test_getBankAccount_UberForNope() {
exampleCode drWho = new exampleCode();
User u = AwesomeTestLib.getUserWithProfile(‘SithProfile’);
Account a = (Account)TestFactory.createSObject(new Account());
Integer result;
System.runAs(u){
Test.startTest();
result = drWho.getBankAccount(a);
Test.stopTest();
}
System.assertEquals(result, null,
‘Expected Sith lords to be blocked’);
}
23. #forcewebinar
Principle #5, User Tests – w/ Permission set
@isTest
private class exampleCode_Tests {
@isTest static void test_getBankAccount_W_PermSet() {
exampleCode drWho = new exampleCode();
User u = AwesomeTestLib.getUserWithProfile(‘Standard User’);
UtilityClass.AssignUserToPermissionSet(u, ‘canReadBankAccount’);
Account a = (Account)TestFactory.createSObject(new Account());
Integer result;
System.runAs(u){
Test.startTest();
result = drWho.getBankAccount(a);
Test.stopTest();
}
System.assertNotEquals(result, null,
‘Expected user with canReadBankAccount to read BankAccount#’);
}
24. #forcewebinar
Principle #6, Use your own data
Always build your own test data.
Unless you have to, never use
@isTest(seeAllData=true)
Rember you can dynamically write assertions:
– AssertEquals(AccountICreated.foo__c, ResultAccount.foo__c,
‘the two accounts should be the same!’);
25. #forcewebinar
Principle #6, Use your own data
General pattern is to
– Create your test data
– Use that test data within your tested method
– Assert your code works as expected
26. #forcewebinar
Principle #6, Use your own data
Tools to make this faster:
– TestFactory, An open source test data factory from Daniel
Hoechst. Found at http://bit.ly/1c5exnV
– Account a = (Account)TestFactory.createSObject(new
Account());
– Opportunity o = (Opportunity)TestFactory.createSObject(new
Opportunity(AccountId = a.Id));
– Account[] aList = (Account[])TestFactory.createSObjectList(new
Account(), 200);
27. #forcewebinar
Principle #7, Use a domain specific test helper lib
Test Helpers facilitate faster test writing
Additionally make tests easier to read, by abstracting
out superfluous code.
Mark your test helper as @isTest to ensure it’s never
called by live code, and to ensure it’s not counted
against you in code coverage
28. #forcewebinar
Principle #7, Use a domain specific test helper lib
Candidates for Test Helper classes include:
– Creating a user object with a given permission set assigned
– Generating complex object trees:
• generateAccountWOppAndProducts()
– Anything you do more than once in a test suite
– Make them public static methods and use a naming convention
• generate* - generates an object
• get* - retrieves an object via SOQL
29. #forcewebinar
Principle #8, Mocking
Integration v. Unit tests
– Integration tests test code in an execution context – Ie setup
some data and execute the code within the context.
– Unit tests focus on a single unit of code, not necessarily a
complete function.
– Mocks allow us to write true unit tests by ‘mocking’ objects.
– You get to setup the mock, and it’s responses.
32. #forcewebinar
Principle #8, Mocking
Use mocks to insert objects whenever that object is not
critical to the test.
– For instance, if you’re testing a method that populates an
Account with the results of a webservice, mock out the web
services’ result.
– This allows you to test just what that method does to the
account object, not it’s ability to talk to a web service
33. #forcewebinar
Principle #8, Mocking
Not just for webservices – Mock all services!
– Mock anything you have in your service layer
– Use interfaces and write the unit test with a mock
implementation
34. #forcewebinar
Principle #8, Mocking
@isTest
Public class exampleCode_Tests{
Public Boolean MockExample(Account a, Account b){
fflib_apexMocks m = new ffLib_apexMocks();
myInterface mock = new MockMyService(m);
m.startStubbing();
m.when(mock.add(5,7)).thenReturn(12);
m.stopStubbing();
Test.startTest();
ExampleCode mockObj = new exampleCode(myAwesomeService);
Integer result = mockObj.add(5,7);
Test.stopTest();
System.assertEquals(12, result, ‘friendly message’);
}
}
35. #forcewebinar
Principle #8, Mocking Part 2
Mocking HTTP Responses
Allows you to test HTTP Callouts without making the
Callout.
Interface requires you to return an HTTP Response
object.
36. #forcewebinar
Principle #8, Mocking Part 2 – Use a factory
@isTest
public with sharing class HTTPMockCalloutFactory implements HttpCalloutMock {
HTTPMockCalloutFactory (Integer code, String status, String body, Map<String,
String> responseHeaders) {
// set class variables here.
}
public HTTPResponse respond(HTTPRequest req) {
HttpResponse res = new HttpResponse();
res.setStatusCode(this.code);
res.setStatus(this.status);
res.setBody(this.bodyAsString);
return res;
}
}
37. #forcewebinar
Principle #8, Mocking Part 2 – Use a factory
You can even extend your factory to return different
response based on a static class variable. Useful for
testing multiple callout scenarios.
– Write an additional constructor that accepts a list of json strings
that de-serialize into responses
38. #forcewebinar
Principle #9, Write for testing
Write small, tightly focused methods that play well with
others.
Compose advanced functionality by using your small
methods together
Write more-or-less unit tests with these focused
methods, and integration tests for customized logic.
39. #forcewebinar
Principle #9, Write for testing: guidelines
Keep your methods to no more than 20 lines.
Keep method arguments to a minimum – no more than
four.
Write your Visualforce controllers to use a single
wrapper object.
– Either mock this wrapper object, or write a Test Helper method
to construct it.
Use descriptive method names!
40. #forcewebinar
Principle #10, Use Continuous Integration!
Continuous Integration is the idea that every code-
change committed to your source repository triggers a
full run of the tests.
A number of tools are available for CI on the
Salesforce1 platform.
Travis.ci, Drone.io, Jenkins and Codeship are some
examples
41. #forcewebinar
Principle #10, Use Continuous Integration!
CI gives you insight to failing tests as soon as they’re
committed not when you try to deploy
Facilitates multiple developers working on the same
project in their own sandboxes / dev orgs
Keeps you aware of code coverage as development
occurs.
42. #forcewebinar
Useful tips
Don’t insert or query unless you have to. You can often
test with objects in memory!
Learn more about Mocking by watching Jesse Altman’s
(@JesseAltman) Excellent intro to mocking with Apex
mocks here: http://bit.ly/1HtXk2B
Write and use a standardized Logging library that wraps
log data in a highly visible header/footer