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

question : is there any way to emulate console input during benchmark? #2058

Closed
BigSquareHasNoEdge opened this issue Jul 30, 2022 · 1 comment

Comments

@BigSquareHasNoEdge
Copy link

I have a console app reading data from Console.ReadLine().
Is there any way to benchmark the app?

@adamsitnik
Copy link
Member

Hi @BigSquareHasNoEdge

Since #2092 (will be released soon as part of 0.13.13) we don't redirect the standard input of the benchmark process. In theory this should make it possible for you to overwrite standard input as part of [GlobalSetup] by using Console.SetIn and let you use Console.Read* methods in your benchmarks.

If this does not work you could redesign your code and feed it with System.IO.TextReader instance. This should make it also unit-testable.

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