- edited description
Apex unit test code generation features
Not sure if this is entirely possible but it would be good to create a more complex Apex test class option.
If your editing a file and you type ALT-INS and select new test class it would be great to be presented with another screen to include:
- Present you with the default name e.g. AbcTest
- Tick box to include @TestSetup method.
- A list of public methods to set up tests for, with a default name for the test method e.g. abcMethod_should_doThis… and maybe do negative test as well e.g. abcMehod_shouldNot_doThis and give you the ability to edit these names.
Let me know if you need more info.
Another thing would be when on a public method give the option of creating tests for that method in the test file.
Comments (4)
-
reporter -
repo owner I like the idea for sure. Given how template-based file creation works in the plugin SDK it wouldn't be possible to have it add more options when you use New>Apex Class and switch to the Apex Unit Test Class option. It would have to be a completely different action.
However, I've been thinking about approaching this just a bit differently. The unit test framework in the plugin SDK supports some of this in a first-class manner using its code generation capabilities. After the test class has been created, you could use Generate similar to this:
and be presented options to generate a
@TestSetup
method (if not already present) or test methods for public and@TestVisible
methods in the most closely associated product class (based on naming convention). Similarly you could initiate this from an untested product class/method to create the associated test class/methods. -
repo owner - changed title to Apex unit test code generation features
- removed version
-
repo owner Closely related to #684.
- Log in to comment