Understanding Mocks in Testing - part 2
Understanding Mocks in Testing - part 2
Ahem yes. I did not give myself much (or any) processing time but I will do later. So back to testing components then:
- When you get to the point in your test/custom render function
- When the query runs
- Then you don't call the query
- You use the MOCKED DATA instead!!!
- SO YOU NEED TO CREATE A STUB OR A MOCK FOR EACH SCENARIO YOU NEED
- YOU NEED TO CREATE A STUB OR A MOCK FOR EACH SCENARIO YOU NEED
This is so important. This is SO important to me. Because this is something I have done before.
And this is something I am quite good at actually. LOGIC. I have done this in AI actually
ANYWAY moving on
So, you need the right mock for each scenario you are testing
I am feeling so tired but I want to get this done.
SO THEN YOU CAN GO:
- When a test fails - what is the code actually expecting?
- IS THE CUSTOM RENDER RECEIVING THE WRONG DATA?
- IS THE TEST RECEIVING THE RIGHT DATA?
- "The digging is what takes the most time after you have written the test"
- And then the investigation begins
Anyway thanks. This was part 1 of my three part learning task. Part 2 was to put this and the last blog post into a flowing diagram.
Part 3 is to create a flow chart of how I debug tests with lots of categories - the terminal, the code etc.
I have forgotten everything over the holidays
I will meet with my mentor to discuss all of this later
And the really key thing will be to develop my own process for debugging tests! Anyway thanks
.png)
Comments
Post a Comment