Write Apex Test Classes efficiently with Tesforce

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.
1. New Project

2.2 New a Test Class

Create a Test Class for the Apex Class.
2. New TestClass

2.3 New a Test Case

A Apex TestMethod is handled as a Test Case in Tesforce.
3. New TestCase

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.
4. Search TestData 5. TestData Assignment 6. TestData Assignment

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.
7. Add Footer 8. Add Footer

2.6 Apex Code Generator

The Apex Code will be generated automatically in background. 9. Code Generator

2.7 Deploy Test Class to Salesforce

10. Deploy TestClass

2.8 Run Test

11. RunTest

Test Results

12. Test Results 13. 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. ; )

Related Post

Salesforce Mass Editor (Chrome Extension) – ... This's my second Chrome Extension (First one is HERE) this year, named "Salesforce Mass Editor" and it supports for doing the below things : ・Makes any Salesforce list view to be a powerful mass editor. ・Mass insert, mass clone, mass update, mass delete, ALL-IN-ONE. ・Export record data to CSV fi...
Salesforce Dev Tools for Chrome™ Salesforce Dev Tools for Chrome™ is a Chrome extension helping Force.com developers do the below things: ・Export definition of objects to Excel file. ・Show / Hide object API name on object detail page by 1 Click. ・Quick generate test data Apex Code for Force.com Unit Test. ・Quick access to new...
Setup an awesome Salesforce developer environment ... Why Sublime Text 3 ? I've been working with Force.com for about 2 years, and always using Eclipse+Force.com IDE(See here, Eclipse Force.com IDE Installation)as my development environment. I don't think it is difficult to use, but it could more friendly. For example: 1. It doesn't support APEX an...
Instantiating an Apex class based on dynamic strin... Somtimes we need to instantiate a Apex class by dynamic value in Salesforce, which can make our program more modular and more readable, such as the below case : 1. Each Contact has its socail fields : "Type__c" and "AccessToken__c" 2. Needs to request its profile via socail api in Apex Firs...