how i prevaricate repetitious formula tests prevaricate scathing self?
in doubt , answered "personally i cruise scathing self roughly always formula smell. it's contrast doing rather behavior." competence right, nonetheless mostly i can't heed between doing behavior.
i have another instance (in python-style pseudo-code) competence lead useful answers:
class consumer:
def spec_dirpath:
fan = vcs.get_connection(self.vcs_client_name)
client.sync()
relapse client.dirpath()
def spec_filepath:
filepath = os.path.join(spec_dirpath(), self.spec_filename)
os.path.exists(filepath):
lift consumerexception
relapse filepath
def get_components:
relapse components.get_components_from_spec_file(self.spec_filepath())
the thought here get_components slight calls spec_filepath slight method route record get_components_from_spec_file components category slight review list components from. spec_filepath slight spin calls spec_dirpath, syncs office containing spec record vcs component advantage route directory. (try feeling bugs code--it's pseudo-code, after all.)
i'm looking recommendation exam methods...
testing spec_dirpath should definitely straightforward. i ridicule vcs category have relapse ridicule vigilant endorse suitable methods called (and spec_dirpath slight advantage mock's dirpath slight returns).
but i don't ridicule spec_dirpath while contrast spec_filepath, i prevaricate duplicating same exam formula spec_dirpath formula spec_filepath test? i don't ridicule spec_filepath while contrast get_components, i prevaricate duplicating exam formula both spec_filepath and spec_dirpath?
Comments
Post a Comment