Feature #9284
Support for local terminal
100%
Related issues
History
#1 Updated by Tomasz Domin over 1 year ago
Currently Harness supports testing using remote terminal over SSH and SOAP testing.
In addition to that it is needed to support local execution of processes started and controlled during test execution.
The simplest case is starting a local command to list local directory. More advanced example may be starting an external tool to run unit tests suite.
I think it can be done in two ways:
- emulating TTY that wraps subprocess input and output streams. That would allow for using all TerminalTestable tests. The problem is it requires running native code to trick subprocess to think its executed inside TTY (tried to use bash in interactive mode to substitute SSH session, but failed, as that needs TTY to work). In best case that would need additional dependencies.
- creating dedicated Executor that works on subprocess input and output streams, that requires few new tests to implement as most of tests providing input and output are TerminalTestable. I started to implement something like StreamTestExecutor to work with IO streams or pipes. It will limit number of available Harness commands but it should be enough to work with locally forked processes if we dont need screen capture.
Given that the feature must support Windows and Linux I am leaning towards the second way.
If you have other ideas please share.
#2 Updated by Tomasz Domin over 1 year ago
I've implemented support for so called stream - maybe I should call it pipe. Its a simple feature that allows filtering piped output from a subprocess and writing text to piped input of subprocess that allows controlling input and output of the process.
- stream-write - write to subprocess input pipe
- stream-read - read from subprocess output pipe into a variable
- stream-wait-for - wait for given string appear on subprocess output pipe.
It works under Linux, I need to test it under Windows.
#3 Updated by Tomasz Domin over 1 year ago
Example scenario may look like:
<?xml version="1.0"?>
<test name="cross_session_002" description="First cross session test" >
<stream-write value="echo abc" newline="true"/>
<stream-write value="echo test2" newline="true"/>
<stream-wait-for value="test2"/>
</test>
#4 Updated by Tomasz Domin over 1 year ago
- Related to Support #9270: design and implement an approach for executing multi-session 4GL testcases added
#5 Updated by Tomasz Domin over 1 year ago
- % Done changed from 0 to 80
#6 Updated by Tomasz Domin over 1 year ago
- % Done changed from 80 to 90
- Assignee set to Tomasz Domin
- Status changed from New to WIP
Tomasz Domin wrote:
I've implemented support for so called
stream- maybe I should call itpipe. Its a simple feature that allows filtering piped output from a subprocess and writing text to piped input of subprocess that allows controlling input and output of the process.
It works under Linux, I need to test it under Windows.
Its tested under Windows and it works correctly.
Note that there is a Harness option -shell that allows overriding subprocess shell which is usefull for running under windows for Linux based test scenarios. Example usage is java -jar build/lib/harness.jar -shell cmd.exe
#7 Updated by Tomasz Domin over 1 year ago
- % Done changed from 90 to 100
I've pushed changes to java code to task branch harness/9270a to be reviewed together with #9270 changes.
#8 Updated by Tomasz Domin over 1 year ago
- Status changed from WIP to Review
#9 Updated by Tomasz Domin about 1 year ago
Updated Documentation to include stream-write, stream-wait-for and stream-read test and -shell command line option. Added description of options for <target type="stream"/>
#10 Updated by Tomasz Domin about 1 year ago
- Status changed from Review to Internal Test
#11 Updated by Greg Shah about 1 year ago
Can we close this?
#12 Updated by Tomasz Domin about 1 year ago
Greg Shah wrote:
Can we close this?
Yes please
#13 Updated by Greg Shah about 1 year ago
- Status changed from Internal Test to Closed