dimanche 24 mai 2015

Stubs, Can anyone answer programming questions using Counterstrike or Halo as an example

I'm certainly learning a lot from this site, but I often find myself stumped with very beginner questions that don't get answered or I am referred to a page that talks in more complicated language.

Here is what I've learned from this site so far that seems to be in a language I can sort of relate to:

Mocking is more specific and object-related: if certain parameters are passed, then the object returns certain results. The behavior of an object is imitated or "mocked".

Stubbing is more general and method-related: a stubbed method usually returns always the same result for all parameters. The behavior of a method is frozen, canned or "stubbed".

A stub is a stand-in and cannot change the outcome of the test. For example, an input parameter that is passed into the subject.

A mock on the other hand can fail a test. It is the basis for the testing the collaboration between objects. If the expected collaboration is not met, the test should fail.

Would someone use a gaming example like in Halo or Counterstrike please.

Something I can relate to, so I can teach it to beginner high school students.

Thanks.

Aucun commentaire:

Enregistrer un commentaire