This is not exactly an issue with the tool but a problem I came accross when implementing some changes in the code
for my experiments. At some point during the execution, I want the user to introduce some data, for instance, a number.
I have been tweaking a bit the code, just to read a number when reaching a point of the code, and I have used Scanner.nextInt for it:
int readValue = 0;
Scanner reader = new Scanner(System.in);
readNumber = reader.nextInt();
When running EvoSuite through a test in Eclipse, it works perfectly. The execution stops when reaching that point, I can certainly introduce a number through the console and then it resumes the execution. However, if I generate the jar file to run EvoSuite outside Eclipse, the execution hangs when reaching that point (the system does not receive the value I enter through the keyboard).
I guess this problem has to do with the replacement that EvoSuite does of the calls to System.in, which is handled by the SystemInUtil.java class. This behaviour can be configured with the property replace_system_in, which is set in the following method in ClientProcess.java. The problem for me is that, when I set this property to false, the system hangs; however, when I set it to true, an exception is thrown when reaching the line with the invocation to nextInt.
Do somebody know what I could do to sort out this problem? Do I have to modify other properties to achieve what I need? Or can I disable the replacement of the input system directly in the code?
Thanks.
Additional info
I have also tried with other input systems, like BufferedReader. Similarly, I also tried to call SystemInUtil.resetSingleton before reading the number to restore the default InputStream (System.in), but the result was exactly the same.
Context
This is not exactly an issue with the tool but a problem I came accross when implementing some changes in the code for my experiments. At some point during the execution, I want the user to introduce some data, for instance, a number. I have been tweaking a bit the code, just to read a number when reaching a point of the code, and I have used
Scanner.nextInt
for it:When running EvoSuite through a test in Eclipse, it works perfectly. The execution stops when reaching that point, I can certainly introduce a number through the console and then it resumes the execution. However, if I generate the jar file to run EvoSuite outside Eclipse, the execution hangs when reaching that point (the system does not receive the value I enter through the keyboard).
I guess this problem has to do with the replacement that EvoSuite does of the calls to System.in, which is handled by the SystemInUtil.java class. This behaviour can be configured with the property replace_system_in, which is set in the following method in
ClientProcess.java
. The problem for me is that, when I set this property tofalse
, the system hangs; however, when I set it totrue
, an exception is thrown when reaching the line with the invocation tonextInt.
Do somebody know what I could do to sort out this problem? Do I have to modify other properties to achieve what I need? Or can I disable the replacement of the input system directly in the code?
Thanks.
Additional info
I have also tried with other input systems, like BufferedReader. Similarly, I also tried to call SystemInUtil.resetSingleton before reading the number to restore the default InputStream (System.in), but the result was exactly the same.