Update docs

This commit is contained in:
Janne Valkealahti
2023-10-07 08:09:51 +01:00
parent 2e95fccbd5
commit 9a5f189783
17 changed files with 30 additions and 24 deletions

View File

@@ -0,0 +1,22 @@
[[using-shell-testing-basics]]
= Basics
ifndef::snippets[:snippets: ../../../../src/test/java/org/springframework/shell/docs]
Spring Shell provides a number of utilities and annotations to help when testing your application.
Test support is provided by two modules: `spring-shell-test` contains core items, and
`spring-shell-test-autoconfigure` supports auto-configuration for tests.
To test _interactive_ commands.
[source, java, indent=0]
----
include::{snippets}/TestingSnippets.java[tag=testing-shelltest-interactive]
----
To test _non-interactive_ commands.
[source, java, indent=0]
----
include::{snippets}/TestingSnippets.java[tag=testing-shelltest-noninteractive]
----

View File

@@ -0,0 +1,20 @@
[[using-shell-testing]]
= Testing
:page-section-summary-toc: 1
ifndef::snippets[:snippets: ../../../../src/test/java/org/springframework/shell/docs]
Testing cli application is difficult due to various reasons:
- There are differences between OS's.
- Within OS there may be different shell implementations in use.
- What goes into a shell and comes out from a shell my be totally
different what you see in shell itself due to control characters.
- Shell may feel syncronous but most likely it is not meaning when
someting is written into it, you can't assume next update in
in it is not final.
NOTE: Testing support is currently under development and will be
unstable for various parts.

View File

@@ -0,0 +1,24 @@
[[using-shell-testing-settings]]
= Settings
ifndef::snippets[:snippets: ../../../../src/test/java/org/springframework/shell/docs]
Built in emulation uses terminal width 80 and height 24 on default.
Changing dimensions is useful if output would span into multiple
lines and you don't want to handle those cases in a tests.
These can be changed using properties `spring.shell.test.terminal-width`
or `spring.shell.test.terminal-height`.
[source, java, indent=0]
----
include::{snippets}/TestingSnippets.java[tag=testing-shelltest-dimensions-props]
----
`ShellTest` annotation have fields `terminalWidth` and `terminalHeight`
which can also be used to change dimensions.
[source, java, indent=0]
----
include::{snippets}/TestingSnippets.java[tag=testing-shelltest-dimensions-field]
----