Sobes.tech
Senior

When conducting code review of colleagues' automated tests, what do you pay attention to first? What red flags do you look for?

sobes.tech AI

Answer from AI

When conducting code review of automated tests, I pay attention to the following points:

  • Scenario coverage: tests should cover both positive and negative cases.
  • Reliability: tests should not be flaky (unstable), it is important that they give predictable results.
  • Readability and maintainability: test code should be understandable, with a logical structure and comments if necessary.
  • Isolation: tests should be independent of each other, not affecting the state of external systems unnecessarily.
  • Use of correct assertion methods: checks should be precise and informative.
  • Absence of redundant waits and timeouts: so that tests do not slow down the build.

Red flags:

  • Hardcoded data that is difficult to change.
  • Complex and long tests that are hard to understand.
  • Using sleep instead of explicit waits.
  • Tests that depend on external services without mocks.
  • Lack of cleanup after tests (for example, created data is not deleted).

Example of a bad pattern:

// Using Thread.sleep instead of wait
Thread.sleep(5000);
assertTrue(element.isDisplayed());

It's better to use explicit waits.

When conducting code review of colleagues' automated… - sobes.tech