Senior
What tests have you written?
sobes.tech AI
Answer from AI
In Go, unit tests are usually written using the testing package. For senior level, it is important to cover not only positive scenarios but also boundary cases, errors, and integration tests to verify component interactions.
Example of a simple test for a function:
func Add(a, b int) int {
return a + b
}
func TestAdd(t *testing.T) {
result := Add(2, 3)
if result != 5 {
t.Errorf("Add(2, 3) = %d; want 5", result)
}
}
Additionally, a senior developer may use dependency mocking, test concurrency, write benchmarks, and use code coverage tools.