Closed joeyleeeeeee97 closed 2 years ago
It depends on what you are trying to do in the "compare result" step in test.run() in the pseudo code above.
STF already has some APIs to obtain std out and std error files of a sub-process's run.
Here you can see that the StfProcess
instance 'p' runs a test process; then a call to p.getStderrFileRef()
is used to reference the standard err file of the process; then another STF API, test.doCountFileMatches(..)
- is used to search the std err file for occurrence of a specific string.
Please have a look at these APIs to see if it serves your purpose. Please let us know if you have more questions.
@Mesbah-Alam, Thanks for the information.
Actually I am trying to do something like this
res1=`cat result1 |awk -F ':' ' { print $2 } '`
res2=`cat result2 |awk -F ':' ' { print $2 } '`
if [ $res1 -lt $res2 ]; then echo "pass"; fi
It seems I need some more interfaces to do this. We could discuss what kind of interfaces are better? :)
I am trying to run an application twice when some function enabled/ disabled, but I found it's hard to add an 'assert step' in STF tests instead of adding new interfaces in StfCoreExtension.
Maybe I am being stupid and missing the point, let me demonstrate through this piece of code
What is the best practice now to do something like this? If we don't have the flexibility to do this now, could we add a new interface for this?