Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hiding Messages #74

Closed
zichaelpath opened this issue May 29, 2019 · 3 comments
Closed

Hiding Messages #74

zichaelpath opened this issue May 29, 2019 · 3 comments

Comments

@zichaelpath
Copy link

Hello,
When using turtle, I'm aware of the expectation fulfilled and unexpected call messages are designed to let you know if you miss a mocked class function call, but is there a way to suppress those calls when you don't know how many times the function is going to be called? in one of our classes, we have a function being called in a thread, however I'd rather not see "expectation fulfilled" 500+ times to either the console or the text file we are writing to. any advice on how to suppress them, or was the library not designed to work that way?

@mat007
Copy link
Owner

mat007 commented May 30, 2019

You can control how many times you expect a call to happen including 'any number of times', see http://turtle.sourceforge.net/turtle/reference.html#turtle.reference.expectation.invocation
If for some reason this does not help you could use a custom error policy, see http://turtle.sourceforge.net/turtle/customization.html#turtle.customization.test_framework_integration but I wouldn't really think this would be needed in you case.

@zichaelpath
Copy link
Author

I meant more along the lines of hiding them all together, at least in the scenario of executing a thread where we don't know when the thread will exit (it exists in a while loop). for right now I've set the tests into individual test cases, each one covering a scenario, but I would like to point out that the file on our test system has a maximum file writing size of 100 KB, practically all of which is used to display the "expectation fullfilled" messages that turtle and boost output.

@mat007
Copy link
Owner

mat007 commented May 30, 2019

Oh right, sorry, I slightly misunderstood your issue…

From what you're describing it seems you're logging Boost.Test outputs to a file, right?
The "expectation fulfilled" messages are logged with level boost::unit_test::log_successful_tests i.e. Success as described in https://www.boost.org/doc/libs/1_70_0/libs/test/doc/html/boost_test/test_output/log_formats/test_log_output.html
So you can either lower the log level, see

(there is probably an environment variable as well)
or as I mentioned before use a custom error policy in turtle http://turtle.sourceforge.net/turtle/customization.html#turtle.customization.test_framework_integration
You can take simply copy the default one https://github.com/mat007/turtle/blob/master/include/turtle/error.hpp and remove the logging in call.

@mat007 mat007 closed this as completed Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants