Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Most unit tests should be migrated to scalatest, use matchers to check output #23

Closed
cyrille-artho opened this issue Jan 23, 2019 · 3 comments

Comments

@cyrille-artho
Copy link
Owner

There is already one test under scalatest, but the output is not checked. Before it can truly replace existing tests, we should have a way of using scalatest matchers to check the occurrence of certain elements in the log, such as should contain inOrder.
This should be implemented such that the stdout and stderr outputs are checked against the patterns.
Ideally, we could learn some common patterns through analysis of the test inputs, and the given test outputs.

@cyrille-artho
Copy link
Owner Author

You can parse the input streams into lines as follows:
scala.io.Source.fromInputStream(is).getLines() where is is out, and err, respectively.

@cyrille-artho
Copy link
Owner Author

For matching the output, you can use the scalatest matchers:
http://www.scalatest.org/user_guide/using_matchers
Probably List(...) should contain List(...) does the trick, where the first list is out, and the second list are the two strings in the argument list (in this particular test).
err should be empty.

@cyrille-artho
Copy link
Owner Author

Fixed in PR #96

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant