Testing Flashcards
What does testing framework allow us to do?
Write unit tests
What do test classes contain?
test classes contain unit tests
What are unit tests?
methods that verify a specific piece of code is behaving correctly
How should we name our test classes?
Name them after the class (for example: AccountTriggerHandler - AccountTriggerHandlerTest)
Test Methods
- Take no Arguments
- Return no Values
- Must be Static
What are the Asserting Values for Test Methods when writing system class methods?
- Assert
- assertEquals
- assertNotEquals
Data in Test classes cannot by default do what?
by default, you cannot access org data
you can give access, but should avoid doing so
When is TestSetup executed?
TestSetup is executed before each individual method
SOQL will only return what?
SOQL will only return records generated in the method or in the test method
SOSL will return what?
SOSL will return an empty list
What do Test Utility Classes have?
Test Utility Classes have reusable code that can be called by multiple test classes
What is TDD?
Test-Driven Development
It is a process that has use cases or requirements that are turned into test classes.
What are the disadvantages of Manual testing?
It is inefficient since you act as an end user and have to go through the same process each time
Why do we write unit tests for our code?
It ensures that our code meets the quality standards and produces the results needed for our production.
Allows code to be routinely tested whenever an update happens to ensure there is no code regression.
What is some best practice to follow when writing test code?
It is recommended to write test code for one piece of our application at a time. We don’t want to write test code for our entire application at once.