montagejs / screening

49 stars 16 forks source link

Our results for assertContains make no sense #257

Open irinamok opened 12 years ago

irinamok commented 12 years ago

assertContains (logger.getText(), "Action event on button#copy");

produces the following result:

Actual value: "Action event on button#copy" Expected value: "[16:54:41] Action event on button" Message: null

which makes no sense because expected value is "Action event on button#copy", and actual is what is retrieved from logger.getText().

We have to either: change the order of arguments in assertContains or fix results reporting for assertContains API

eliseosoto commented 12 years ago

IIRC the order was changed because assertContains is primarily used for arrays. There was a reason for this change but I don't remember exactly what was it. Any comments @zacharyc?

It looks like you want to assert if a substring is contained inside another string. Should we have another assert to make this clearer? Something like assertStringContains() maybe?

zacharyc commented 12 years ago

The first suggestion makes no sense. Expected and Actual have no meaning in the function assertContains so switching the order really does nothing. We have to fix our reporting algorithm to do parameter inspection or something like that to come up with better names.

zacharyc commented 12 years ago

Changing the order name of the function does not remove the problem that terms actual and expected do not make sense in the context of assertContains. We need to find a better way to do this.