Recently while fixing a bug in the system and thereof writing test for it we placed a large block of html string in the test source code. My only concern with that is that the large block are distractive and compromise the readability of the code.
Some, obvious, solutions for i that I came up with were:
- Move the individual block of text into separate text files which are read when the test is run. (My concern with this: efficiency and scalability)
- Move the blocks of text into a single json file and load it into a json object once (not quite confident about this solution. Overkill, if we only happen to have a few such tests with large blocks of text?)
- create a separate code file within the same package that would contain the blocks (same concerns as the previous one)
- stick with the current solution i.e. the large block of code inside the source code. And that it's not a big issue.
Language: Go
Questions:
- Which of the earilier solutions would be optimal? Or some other solution?
- Good to know: Is the solution to this concern dependent on the programming language that is in use?
Aucun commentaire:
Enregistrer un commentaire