Unit Test

Golang

Golang How to mock an object by yourself for unit testing

It might be too big to introduce a mock framework. It's better to create a mock object by ourselves in this case.
Python

Python How to use fixture in pytest to share a function

How can we write when we want to add a function that is executed for all tests, e.g. pre-process and post-process? If you want to know how to use fixture, this post is for you.
Python

Python mockito to stub an object for unit testing

mockito in Python doesn't have good documentation due to poor examples. I struggled with it to learn how to do something. If you also in the same situation, this post is for you. Stub, replace a method behavior, and verify the parameters!
Sponsored links
Python

Python How to pass a list to parametrize in Pytest

I searched for a way to pass a list as a parameter but I didn't find the answer. Because it is too easy to do...? Pa...
Python

Python How to start unit tests with pytest

This post is for those who want to start unit testing in Python with pytest. How should file name and function name look like? How can we compare results? What if the function throws an error? This post guides you to unit testing world!
JavaScript/TypeScript

A good way to write our own Node-RED node for the testability

I have used Node-RED for more than 3 years for my working project. I came up with a good idea to write our own node for...
JavaScript/TypeScript

Top-Level function cannot be stubbed if it is exported by an asterisk

A top-level function is not a part of an object. If we need to stub it, we need to have an object that has the target f...
JavaScript/TypeScript

What is the difference between Stub and Mock

In a unit test, we need to replace a real behavior with a test object but the variable name is sometimes xxxxStub for m...
JavaScript/TypeScript

TypeScript Stub Date and timer friends functions with sinon

When Date class, timer friends functions like setTimeout, and setInterval are used in a function, we need to control th...
JavaScript/TypeScript

How to determine test values for unit testing

Are you a beginner at unit testing? Are you not confident enough to choose the test cases? You are not alone. Let's lea...
Copied title and URL