利用Tesforce高效地进行Apex Test Class编程
- 10月
- 15
- Posted by Lin
- Posted in 应用, Heroku, Salesforce, Salesforce DevTools, Unit Tests
1.Why Tesforce
The Test Classes are required to deploy Apex to a production environment or to be packaged and placed on Force.com AppExchange, it must provide at least 75% code coverage.That will be a huge workload to SFDC Developers if the project(application) include a lot of Apex Classes,the cost of time to write Test Classes for them even more than to write themselves.So why cannot generate the Test Code automatically,or how can we write the test code more efficiently? We(at least me) really need a application which can generate most of code that we don’t have to write, such as Test Data Creating,can solve the potential problems of reference fields and required fields for us, and more.
Tesforce is the application I created to satisfy the needs, which is dedicated to minimize our coding work and help us to focus on the application logic.
Let me show you the basic usage of Tesforce.
2.Usage of Tesforce
Sample Test Class
2.1 New a Project
Create a project with your SFDC account and password.If you don’t want your password to be saved,don’t forget to off the “Save Password” checkbox.And Tesforce also supports adding project through Salesforce OAuth2, by click “Login with Salesforce” button.
2.2 New a Test Class
Create a Test Class for the Apex Class.2.3 New a Test Case
A Apex TestMethod is handled as a Test Case in Tesforce.2.4 Select an existing data
Choose any existing data as a “Data Template”,Tesforce will solve the problems such as reference fields, required fields and the others.2.5 Make up Header and Footer
Now add Apex Test Code into header tag or footer tag by necessity,such as setting parameters for ApexPages,or run an Apex Class.2.6 Apex Code Generator
The Apex Code will be generated automatically in background.2.7 Deploy Test Class to Salesforce
2.8 Run Test
Test Results
Since it is still in beta, please do keep in mind that there may be bugs. I encourage you to send your feedback if you encounter them and also to share your ideas for what would make it even more awesome.Enjoy Tesforce. It’s better up here. ; )
近期文章
- Salesforce DevTools Release Notes (version 3.10.0) – mass edit custom fields on lightning
- Salesforce DevTools Release Notes (version 3.9.0)- Object Fields, SOQL Query Editor
- Salesforce DevTools Release Notes (version 3.8.0)
- Salesforce DevTools的开发者用户突破10,000名!THANK YOU!
- Lightning Component中使用Promise处理Apex服务端请求
Top Posts
- Salesforce DevTools – Saleforce开发者必备Chrome扩展 - 225K views
- Date format 与 DateTime format - 208.7K views
- Salesforce批量编辑 (Chrome扩展) – 在任何标准视图上进行批量插入, 拷贝, 更新, 删除, 支持Classic与Lightning! - 160.5K views
- 编写一个可被计划执行的Batch Apex - 123.5K views
- 用Sublime Text 3架设Salesforce的快速开发环境 - 122.9K views
分类目录
- APEX
- 应用
- Custom Label
- Custom Metadata
- Custom Setting
- Design & UI
- 交流会
- Heroku
- iOS & Object-c
- Lightnint Component
- Linux & Mac OS
- Metadata API
- Node.js
- Open Source
- Other
- PHP Framework
- Release Notes
- REST API
- Salesforce
- Salesforce DevTools
- Salesforce DX
- SOQL
- Tooling API
- Unit Tests
- Validation Rule
- Visualforce
- WordPress
您必须登录才能发表评论。