Testing shell features within unit tests is not always enough to have a full coverage as shell
applications has been traditionally been difficult to test as there is too many moving parts.
While it is relative easy to test parts of a java code in your spring-shell
app, knowing those
will actualy execute with as run in a hosting environment is totally different topic. As
spring-shell` application can be run on a different environment either a simple spring-boot
app
via java runtime environment or via graalvm
build binary many things can simply go wrong.
spring-shell-e2e
is a node module which uses node-pty
and xterm.js
to run your
shell application whether you run shell in any ways as it just assumes a command runs
a shell application. Relationship between node-pty
and xterm.js
is that pty environment
is providing underlying host capabilities running shell applications and xterm having
a knowledge to translate all shell command sequinces to a representive text.
Note
|
We chose to use javascript space for e2e framework as it provides a good set of libraries to work with various environments and is much more close to native environment what we could do from a java space. |
spring-shell-e2e-tests
is simply using spring-shell-e2e
to implement e2e tests and
runs both fatjar and native built apps.
spring-shell-e2e
is work-in-progress so it’s not yet published into npmjs.
Generic workflow to run spring-shell-e2e-tests
is:
spring-shell
$ ./gradlew :spring-shell-samples:spring-shell-sample-e2e:build :spring-shell-samples:spring-shell-sample-e2e:nativeCompile -PspringShellSampleE2E=true -x test
spring-shell/e2e/spring-shell-e2e
$ npm install
$ npm run build
spring-shell/e2e/spring-shell-e2e-tests
$ npm install
$ npm test