/Unit-Tests

Hands on challenge to write the unit tests for a utility method.

Primary LanguageApexMIT LicenseMIT

Coding 101 - Unit Testing

Setup

Fork this repository

Create a new branch - name it whatever you like, but note it down!

Clone to your local machine

On your local machine, cd into the directory created for your clone and switch to your new branch using the command:

git checkout <branchname>

Challenge

  1. Build out the ./force-app/main/default/OpportunityUtils_Test.cls class to cover all scenarios you can identify. Note that 100% test coverage does not indicate all scenarios are covered! Check all of your unit tests pass before submitting your solution.

Notes

The following Trailhead modules are available to learn more about unit testing in Apex:

Implementing

Carry out all work in your local filesystem using VS Code, as you will need to send them back to Github.

  1. Create a scratch org (or connect to an existing one)
  2. Push the code to your scratch org - this will check that your code compiles
  3. Execute the tests - this will check that your tests are doing what you think they are

Submitting Your Solution for Assessment

Please note that assessment is only available to BrightGen employees or by prior arrangement with Keir Bowden (aka Bob Buzzard). If you don't satisfy this criteria your pull request will not be reviewed.

Add keirbowden as a collaborator to your new repository

The commands below are if you are using Git from the command line - you can also use the VS Code built-in source control functionality.

Stage your updated class using the following command:

git add force-app/main/default/classes

and then commit the changes :

git commit

and push these to the remote repository

git push origin <branchname>

Once you are happy with your solution, open a pull request

Then wait!