Open and run a terminal/cmd from a test case

I am using a MacBookPro and need to combine WebUI testing with Terminal Commands. Is there a way to open a Terminal window and run a command during the middle of a test case.

Loosely speaking, “yes”.

Grab a coffee and get ready for some reading…

https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html

https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#exec-java.lang.String-

Hello,

check this page
https://www.mkyong.com/java/how-to-execute-shell-command-from-java/