Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 1
    I kept it vague because the core logic should be loosely coupled to the coordinate system. You should be able to reuse it across 2D and 3D implementations. If new_pos = old_pos + vel is wrong, it's due to my poor grasp of physics. (Also, I imagined velocity to be a simple vector, like position.) Regarding new_velocity, this scenario tests that, every tick, a boid's position is updated according to its velocity. Ensuring its velocity is updated appropriately belongs elsewhere. Finally, regarding random numbers, I considered that, but I dislike the potential for flaky tests. Commented Dec 28, 2023 at 9:24
  • 2
    BDD doesn't hide details, OP their (example) usage of BDD hides details. There is no reason the scenario couldn't be Given a Boid at position 1,2,3, When it moves 0,1,2, Then its position should be 1,3,5. Commented Dec 28, 2023 at 10:07
  • 6
    @JoryGeerts BDD encourages hiding details, because it's meant to be written as human-readable English, which is then parsed very differently by brains and the underlying BDD statement parser. Of course you could write clear BDD statements, but at that point it would be at least as verbose as the underlying code. Commented Dec 28, 2023 at 10:25
  • 5
    @JoryGeerts, I have to agree with l0b0 here. BDD is not meant to be detailed technical specifications. I also think people are too focused on the particular scenario in the question. The idea is you express the behavior of the system as an end-user would understand it. I think this answer brings up a good point. There is a line where vital behavior is so finely detailed that it becomes a poor fit for a BDD scenario, because it is too low-level. Something this vital and low-level is a better fit for a unit test. Commented Dec 28, 2023 at 17:00
  • Or in other words: test at the appropriate level of abstraction, and given the example in the question, I do not believe a BDD scenario is the appropriate level of abstraction to verify this behavior. Commented Dec 28, 2023 at 17:00