teuton 2.10.8 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +65 -18
- data/docs/commands/README.md +18 -81
- data/docs/commands/check.md +66 -0
- data/docs/commands/config.md +120 -0
- data/docs/commands/help.md +37 -0
- data/docs/commands/new.md +34 -0
- data/docs/commands/readme.md +52 -0
- data/docs/commands/{run-tests.md → run.md} +1 -1
- data/docs/config_file.md +125 -0
- data/docs/devel/README.md +12 -0
- data/docs/dsl/expect.md +2 -2
- data/docs/dsl/run.md +30 -67
- data/docs/install/s-node.md +9 -7
- data/docs/install/t-node.md +18 -19
- data/docs/learn/11-export.md +1 -1
- data/docs/learn/13-feedback.md +1 -1
- data/docs/learn/14-moodle_id.md +4 -4
- data/docs/learn/15-readme.md +14 -8
- data/docs/learn/16-include.md +21 -16
- data/docs/learn/17-alias.md +2 -2
- data/docs/learn/18-log.md +5 -3
- data/docs/learn/19-read_vars.md +7 -3
- data/docs/learn/20-macros.md +6 -4
- data/docs/learn/21-exit_codes.md +3 -3
- data/docs/learn/22-result.md +7 -3
- data/docs/learn/23-test-code.md +17 -7
- data/docs/learn/24-test-sql.md +19 -18
- data/docs/learn/25-expect-result.md +1 -0
- data/docs/learn/26-expect_sequence.md +12 -7
- data/docs/learn/27-run_script.md +11 -5
- data/docs/tutorial/es/nginx/README.md +546 -0
- data/lib/teuton/case/case.rb +0 -2
- data/lib/teuton/case/dsl/expect.rb +2 -2
- data/lib/teuton/case/dsl/log.rb +1 -1
- data/lib/teuton/case/dsl/run.rb +2 -3
- data/lib/teuton/case/dsl/upload.rb +1 -1
- data/lib/teuton/case/execute/execute_base.rb +3 -6
- data/lib/teuton/case/execute/execute_local.rb +5 -2
- data/lib/teuton/case/execute/execute_ssh.rb +0 -1
- data/lib/teuton/case/execute/execute_telnet.rb +0 -2
- data/lib/teuton/case/play.rb +2 -2
- data/lib/teuton/case/result/result.rb +1 -3
- data/lib/teuton/case_manager/case_manager.rb +14 -17
- data/lib/teuton/case_manager/dsl.rb +4 -4
- data/lib/teuton/case_manager/export_manager.rb +22 -17
- data/lib/teuton/case_manager/{check_cases.rb → ext/check_cases.rb} +7 -6
- data/lib/teuton/case_manager/ext/hall_of_fame.rb +28 -0
- data/lib/teuton/case_manager/{report.rb → ext/report.rb} +6 -8
- data/lib/teuton/case_manager/send_manager.rb +1 -0
- data/lib/teuton/case_manager/{show_report.rb → show_resume_report.rb} +12 -26
- data/lib/teuton/case_manager/stats_manager.rb +26 -0
- data/lib/teuton/check/checker.rb +16 -8
- data/lib/teuton/check/main.rb +2 -2
- data/lib/teuton/check/show.rb +3 -3
- data/lib/teuton/cli.rb +3 -2
- data/lib/teuton/readme/dsl/getset.rb +1 -0
- data/lib/teuton/readme/main.rb +2 -2
- data/lib/teuton/readme/readme.rb +2 -2
- data/lib/teuton/report/formatter/default/array.rb +1 -3
- data/lib/teuton/report/formatter/default/markdown.rb +1 -1
- data/lib/teuton/report/formatter/default/txt.rb +1 -1
- data/lib/teuton/report/formatter/default/xml.rb +93 -29
- data/lib/teuton/report/formatter/formatter.rb +2 -1
- data/lib/teuton/report/formatter/resume/array.rb +1 -3
- data/lib/teuton/report/formatter/resume/txt.rb +6 -2
- data/lib/teuton/report/formatter/resume/xml.rb +92 -0
- data/lib/teuton/report/report.rb +1 -1
- data/lib/teuton/utils/config_file_reader.rb +141 -0
- data/lib/teuton/utils/name_file_finder.rb +12 -15
- data/lib/teuton/utils/project.rb +19 -21
- data/lib/teuton/utils/settings.rb +3 -1
- data/lib/teuton/version.rb +1 -1
- data/lib/teuton.rb +11 -10
- metadata +35 -30
- data/docs/commands/check-example.md +0 -53
- data/docs/es/aprender/01-cmd_new.md +0 -27
- data/docs/es/aprender/02-target.md +0 -131
- data/docs/es/aprender/README.md +0 -36
- data/docs/ideas/todo.md +0 -44
- data/docs/install/README.md +0 -38
- data/lib/teuton/case_manager/hall_of_fame.rb +0 -29
- data/lib/teuton/files/README.md +0 -9
- data/lib/teuton/utils/configfile_reader.rb +0 -135
- /data/docs/{ideas → devel}/contributions.md +0 -0
- /data/docs/{ideas → es}/Challenge-Server-Project.md +0 -0
- /data/docs/{ideas → es}/servidor-de-retos.md +0 -0
- /data/docs/{install/modes_of_use.md → modes_of_use.md} +0 -0
- /data/lib/teuton/{case_manager → deprecated}/utils.rb +0 -0
data/docs/dsl/expect.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# expect
|
|
4
4
|
|
|
5
|
-
Compare the obtained result with the expected one. This
|
|
5
|
+
Compare the obtained result with the expected one. This result is registered into final report.
|
|
6
6
|
|
|
7
7
|
## Example
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ Let's see some examples:
|
|
|
11
11
|
```ruby
|
|
12
12
|
target "Exist user obiwan"
|
|
13
13
|
run "id obiwan"
|
|
14
|
-
|
|
14
|
+
expect_ok
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Simple evaluations
|
data/docs/dsl/run.md
CHANGED
|
@@ -13,83 +13,42 @@ Execute command on localhost and save output into result object.
|
|
|
13
13
|
run "id COMMAND"
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
In fact it's the same as doing next:
|
|
19
|
-
|
|
16
|
+
Alias:
|
|
20
17
|
```ruby
|
|
21
18
|
run "COMMAND", on: :localhost
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
```ruby
|
|
25
19
|
run "COMMAND", on: 127.0.0.1
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
```ruby
|
|
29
20
|
run "COMMAND", on: 'localhost'
|
|
30
21
|
```
|
|
31
22
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
```ruby
|
|
35
|
-
run "id david"
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
* This instruction execute "id david" command on local machine, and save results into **result** object.
|
|
39
|
-
* Local machine is where the `Teuton` program is running.
|
|
23
|
+
* This instruction execute "COMMAND" command on local machine, and save results into **result** object.
|
|
24
|
+
* Local machine is where the Teuton program is running.
|
|
40
25
|
|
|
41
|
-
---
|
|
42
26
|
# Remote run
|
|
43
27
|
|
|
44
28
|
Connect to remote host and executes command. The command output is saved into **result** object.
|
|
45
29
|
|
|
46
30
|
```ruby
|
|
47
|
-
run "COMMAND", on: :
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
* This example connect to remote host identified by `hostID`. Then we execute the command into it and save the output commadn into result object.
|
|
51
|
-
* Label `hostID` identifies specific machine. Host information (ip, username, password, protocol) cames from config file.
|
|
52
|
-
|
|
53
|
-
## Alias
|
|
54
|
-
|
|
55
|
-
I know that programers dislike `goto` sentence, but this is diferent. Think of it as english speaker, not as developer.
|
|
56
|
-
|
|
57
|
-
```ruby
|
|
58
|
-
on :hostID, run: "COMMAND"
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
```ruby
|
|
62
|
-
goto :hostID, :exec => "COMMAND"
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Examples
|
|
66
|
-
|
|
67
|
-
Execute `id obiwan` comand into remote host `:linux1`.
|
|
68
|
-
|
|
69
|
-
```ruby
|
|
70
|
-
run "id obiwan", on: :linux1
|
|
31
|
+
run "COMMAND", on: :HOSTID
|
|
71
32
|
```
|
|
72
33
|
|
|
73
|
-
|
|
34
|
+
* This example connect to remote host identified by `HOSTID`. Then we execute the command into it and save the output commadn into result object.
|
|
35
|
+
* Label `HOSTID` identifies specific machine. Host information (ip, username, password, protocol) cames from config file.
|
|
74
36
|
|
|
37
|
+
**Example**:
|
|
75
38
|
```ruby
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
on :linux1, :run => "id obiwan"
|
|
79
|
-
goto :linux1, exec: "id obiwan"
|
|
80
|
-
goto :linux1, :exec => "id obiwan"
|
|
39
|
+
# Execute `id obiwan` comand into remote host `:tatooine`.
|
|
40
|
+
run "id obiwan", on: :tatooine
|
|
81
41
|
```
|
|
82
42
|
|
|
83
|
-
##
|
|
43
|
+
## Protocols
|
|
84
44
|
|
|
85
|
-
|
|
45
|
+
### SSH connection
|
|
86
46
|
|
|
87
47
|
Invoking `run` sentence, will open SSH session with remote host by default.
|
|
88
|
-
This config files examples do the same:
|
|
89
48
|
|
|
90
|
-
|
|
49
|
+
**Example 1**. By default, SSH connection is established with remote host:
|
|
91
50
|
|
|
92
|
-
```
|
|
51
|
+
```yaml
|
|
93
52
|
---
|
|
94
53
|
:config:
|
|
95
54
|
---
|
|
@@ -101,9 +60,9 @@ Sample 1. By default, SSH connection is established with remote host:
|
|
|
101
60
|
:host1_password: secret
|
|
102
61
|
```
|
|
103
62
|
|
|
104
|
-
|
|
63
|
+
**Example 2**. `host1_protocol: ssh` force SSH connection with remote host:
|
|
105
64
|
|
|
106
|
-
```
|
|
65
|
+
```yaml
|
|
107
66
|
---
|
|
108
67
|
:config:
|
|
109
68
|
---
|
|
@@ -116,11 +75,13 @@ Sample 2. `host1_protocol: ssh` force SSH connection with remote host:
|
|
|
116
75
|
:host1_protocol: ssh
|
|
117
76
|
```
|
|
118
77
|
|
|
119
|
-
|
|
78
|
+
### Telnet connection
|
|
79
|
+
|
|
80
|
+
Open Telnet session with remote host.
|
|
120
81
|
|
|
121
82
|
`host1_protocol: telnet` force Telnet connection with remote host:
|
|
122
83
|
|
|
123
|
-
```
|
|
84
|
+
```yaml
|
|
124
85
|
---
|
|
125
86
|
:global:
|
|
126
87
|
:cases:
|
|
@@ -131,23 +92,25 @@ Sample 2. `host1_protocol: ssh` force SSH connection with remote host:
|
|
|
131
92
|
:host1_protocol: telnet
|
|
132
93
|
```
|
|
133
94
|
|
|
134
|
-
|
|
135
|
-
Teuton will assume that you want to run your command on local system, and no remote session is opened.
|
|
136
|
-
This examples are the same:
|
|
95
|
+
### Localhost
|
|
137
96
|
|
|
97
|
+
When host is "localhost", or `host_ip: 127.0.0.*` , then Teuton will assume that you want to run your command on local system, and no remote session is opened.
|
|
98
|
+
|
|
99
|
+
Examples:
|
|
138
100
|
```
|
|
139
101
|
run "id david"
|
|
102
|
+
run "id david", on: :localhost
|
|
103
|
+
run "id david", on: 'localhost'
|
|
140
104
|
```
|
|
141
105
|
|
|
142
|
-
|
|
106
|
+
### SSH to localhost
|
|
143
107
|
|
|
144
|
-
|
|
145
|
-
goto :localhost, :exec => "id david"
|
|
146
|
-
```
|
|
108
|
+
Force SSH session to localhost.
|
|
147
109
|
|
|
148
|
-
|
|
110
|
+
Iw you need to force SSH connection to localhost, then set param `host1_protocol: ssh`.
|
|
149
111
|
|
|
150
|
-
|
|
112
|
+
Example:
|
|
113
|
+
```yaml
|
|
151
114
|
---
|
|
152
115
|
:global:
|
|
153
116
|
:cases:
|
data/docs/install/s-node.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
[<< back](README.md)
|
|
1
|
+
[<< back](../../README.md)
|
|
2
2
|
|
|
3
|
-
# S-NODE
|
|
3
|
+
# S-NODE Installation
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
_S-NODE is a host with SSH/Telnet service installed. S-NODE hosts are monitorized by T-NODE host._
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
S-NODES needs to have the SSH or Telnet service installed.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## SSH server installation
|
|
10
|
+
|
|
11
|
+
**SSH GNU/Linux installation**
|
|
10
12
|
|
|
11
13
|
Run this command as `root` user:
|
|
12
14
|
|
|
@@ -14,7 +16,7 @@ Run this command as `root` user:
|
|
|
14
16
|
wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/install/linux/s-node_install.sh | bash
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
**Windows installation**
|
|
19
|
+
**SSH Windows installation**
|
|
18
20
|
|
|
19
21
|
Requirements:
|
|
20
22
|
* Windows 7+ / Windows Server 2003+
|
|
@@ -26,7 +28,7 @@ Run this command on **PowerShell (PS)** as `Administrator` user:
|
|
|
26
28
|
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/master/install/windows/s-node_install.ps1'))
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
**Mac OS X installation**
|
|
31
|
+
**SSH Mac OS X installation**
|
|
30
32
|
|
|
31
33
|
Run this command as `root` user:
|
|
32
34
|
|
data/docs/install/t-node.md
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
[<< back](README.md)
|
|
1
|
+
[<< back](../../README.md)
|
|
2
2
|
|
|
3
3
|
# T-NODE installation
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
_T-NODE is a host with Teuton installed. T-NODE monitors one or severals S-NODE hosts._
|
|
6
6
|
|
|
7
|
-
Installation:
|
|
8
7
|
1. Install Ruby on your system.
|
|
9
8
|
2. `gem install teuton`
|
|
10
9
|
|
|
11
|
-
Run `teuton version` to check the installed version.
|
|
12
|
-
|
|
13
10
|
> NOTE:
|
|
11
|
+
> * Show current version: `teuton version`.
|
|
12
|
+
> * Install a specific version: `gem install teuton -v VERSION`. Available versions ([rubygems.org/gems/teuton](https://rubygems.org/gems/teuton/)).
|
|
14
13
|
> * Update: `gem update teuton`.
|
|
15
14
|
> * Uninstall: `gem uninstall teuton`.
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
## 1. Problems
|
|
18
17
|
|
|
19
18
|
Sometimes we don't find `teuton` command (OpenSUSE distro, for example), so try this:
|
|
20
19
|
|
|
@@ -26,11 +25,11 @@ Option B:
|
|
|
26
25
|
* `find /usr/lib64/ruby -name teuton`, to find absolute path to teuton command.
|
|
27
26
|
* `sudo ln -s /PATH/TO/bin/teuton /usr/local/bin/teuton`, to create symbolic link to teuton command.
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
## 2. Installation scripts
|
|
30
29
|
|
|
31
30
|
If you don't know how to install Ruby on your system, execute this script to run automatical installation for your OS.
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
### 2.1 GNU/Linux installation
|
|
34
33
|
|
|
35
34
|
Run this command as `root` user:
|
|
36
35
|
|
|
@@ -38,7 +37,7 @@ Run this command as `root` user:
|
|
|
38
37
|
wget -qO- https://raw.githubusercontent.com/teuton-software/teuton/master/install/linux/t-node_install.sh | bash
|
|
39
38
|
```
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
### 2.2 Windows installation
|
|
42
41
|
|
|
43
42
|
Requirements:
|
|
44
43
|
* Windows 7+ / Windows Server 2003+
|
|
@@ -50,7 +49,7 @@ Run this command on **PowerShell (PS)** as `Administrator` user:
|
|
|
50
49
|
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/teuton-software/teuton/master/install/windows/t-node_install.ps1'))
|
|
51
50
|
```
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
### 2.3 Mac OS X installation
|
|
54
53
|
|
|
55
54
|
Run this command as admin user (member of `admin` group):
|
|
56
55
|
|
|
@@ -58,11 +57,11 @@ Run this command as admin user (member of `admin` group):
|
|
|
58
57
|
curl -sL https://raw.githubusercontent.com/teuton-software/teuton/master/install/mac/t-node_install.sh | bash
|
|
59
58
|
```
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
## 3. Vagrant and Docker installation
|
|
62
61
|
|
|
63
62
|
Choose this way if you plan to install Teuton into virtual machines or containers, and you are familiar with Vagrant and Docker technologies.
|
|
64
63
|
|
|
65
|
-
##
|
|
64
|
+
## 3.1 Install using Vagrant
|
|
66
65
|
|
|
67
66
|
* First, install `Vagrant` and `VirtualBox` on your host.
|
|
68
67
|
* Create directory for vagrant project. For example, `mkdir teuton-vagrant`.
|
|
@@ -70,7 +69,7 @@ Choose this way if you plan to install Teuton into virtual machines or container
|
|
|
70
69
|
* Choose and download [Vagrantfile](../../install/vagrant).
|
|
71
70
|
* Run `vagrant up` to create your Virtual Machine.
|
|
72
71
|
|
|
73
|
-
##
|
|
72
|
+
## 3.2 Install using Docker
|
|
74
73
|
|
|
75
74
|
First:
|
|
76
75
|
* Install `docker` on your host.
|
|
@@ -79,13 +78,13 @@ Second, choose:
|
|
|
79
78
|
* Pulling docker image from remote or
|
|
80
79
|
* Rebuild local docker image.
|
|
81
80
|
|
|
82
|
-
##
|
|
81
|
+
## 3.2 Pulling docker images from remote
|
|
83
82
|
|
|
84
83
|
Run this command to pull **dvarrui/teuton** image from Docker Hub and create "teuton" container:
|
|
85
84
|
|
|
86
85
|
`docker run --name teuton -v /home/teuton -i -t dvarrui/teuton /bin/bash`
|
|
87
86
|
|
|
88
|
-
##
|
|
87
|
+
## 3.2 Rebuild local docker image
|
|
89
88
|
|
|
90
89
|
1. Create Dockerfile like this:
|
|
91
90
|
|
|
@@ -112,7 +111,7 @@ CMD ["/bin/bash"]
|
|
|
112
111
|
|
|
113
112
|
> Notice `/home/teuton` folder is persistent volume.
|
|
114
113
|
|
|
115
|
-
|
|
114
|
+
## 4. Source code
|
|
116
115
|
|
|
117
116
|
If you want to install Teuton by your own, or there are not installation scripts for your OS, and you don't want to use Vagrant then... here you have information how to install all the required packages for Teuton.
|
|
118
117
|
|
|
@@ -132,9 +131,9 @@ Manual installation:
|
|
|
132
131
|
1. Move into Teuton folder
|
|
133
132
|
* Run `cd teuton`
|
|
134
133
|
1. Gems installation.
|
|
135
|
-
* `rake install
|
|
134
|
+
* `rake install`, to install required gems.
|
|
136
135
|
1. Only for developers
|
|
137
|
-
* Run `rake
|
|
138
|
-
* `rake
|
|
136
|
+
* Run `rake devel:debian` or
|
|
137
|
+
* `rake devel:opensuse`, install gem for developers.
|
|
139
138
|
1. Final check
|
|
140
139
|
* `rake`
|
data/docs/learn/11-export.md
CHANGED
data/docs/learn/13-feedback.md
CHANGED
data/docs/learn/14-moodle_id.md
CHANGED
|
@@ -6,7 +6,7 @@ As a teacher, probably you are using Moodle platform. So, you want to upload the
|
|
|
6
6
|
|
|
7
7
|
Teuton generates a file called `moodle.csv` with the grades of each student into CSV format. This file is suitable to import into Moodle platform.
|
|
8
8
|
|
|
9
|
-
## tt_moodle_id
|
|
9
|
+
## `tt_moodle_id` param
|
|
10
10
|
|
|
11
11
|
Add a new field called `tt_moodle_id` to each case in "config.yaml". Fill it with the student's Moodle identification. For example, registered email on or ID number on Moodle platform.
|
|
12
12
|
|
|
@@ -21,15 +21,15 @@ cases:
|
|
|
21
21
|
tt_moodle_id: obiwan@starwars.com
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
After test execution, use "moodle.csv" output file to load students grades and feedback into your Moodle platform.
|
|
25
25
|
|
|
26
|
-
## tt_moodle_max_score
|
|
26
|
+
## `tt_moodle_max_score` param
|
|
27
27
|
|
|
28
28
|
By default, teuton evaluates grades from 0 to 100. So grade max score is 100.0 by default. Sometimes teachers configure their moodle tasks with diferents max score, so it is necesary adjust Teuton output grades with Moodle input grades.
|
|
29
29
|
|
|
30
30
|
We use `tt_moodle_max_score` to customize Moodle max score. So when Teuton export `moodle.csv` values, divides Teuton grades by this value.
|
|
31
31
|
|
|
32
|
-
Example
|
|
32
|
+
## Example
|
|
33
33
|
|
|
34
34
|
```
|
|
35
35
|
global:
|
data/docs/learn/15-readme.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
[<< back](README.md)
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# readme
|
|
4
4
|
|
|
5
5
|
Create README files (with test instructions) from our test definition.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Example
|
|
8
8
|
|
|
9
9
|
Take a look at our test definition section (Group):
|
|
10
|
+
|
|
10
11
|
```ruby
|
|
11
12
|
group "Customize readme output" do
|
|
13
|
+
|
|
12
14
|
readme "This is our README example."
|
|
13
15
|
readme "And here we'll see how to use readme keyword"
|
|
14
16
|
|
|
@@ -26,28 +28,32 @@ end
|
|
|
26
28
|
|
|
27
29
|
There exists some `readme` instructions after `group` and `target` lines.
|
|
28
30
|
|
|
29
|
-
##
|
|
31
|
+
## Execution
|
|
30
32
|
|
|
31
33
|
To generate automatically a README file from previous test, execute this:
|
|
32
34
|
|
|
33
35
|
```
|
|
34
|
-
teuton readme example/15-readme > example/15-readme/README.md
|
|
36
|
+
$ teuton readme example/15-readme > example/15-readme/README.md
|
|
35
37
|
```
|
|
36
38
|
|
|
37
39
|
## Result
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
Content of `example/15-readme/README.md` file.
|
|
40
42
|
|
|
41
43
|
---
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
```
|
|
46
|
+
Date : 2025-11-12 22:11:47 +0000
|
|
47
|
+
Teuton : 2.10.7
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
# Test: 15-readme
|
|
44
51
|
|
|
45
52
|
## Customize readme output
|
|
46
|
-
|
|
47
53
|
This is our readme example.
|
|
48
54
|
And here we'll see how to use readme keyword
|
|
49
55
|
|
|
50
56
|
Go to [LOCALHOST](#required-hosts) host, and do next:
|
|
51
|
-
* Create user david.
|
|
57
|
+
* (x1.0) Create user david.
|
|
52
58
|
* Help: you can use 'useradd' command to create users.
|
|
53
59
|
* Remember: Only root is permitted to create new users.
|
data/docs/learn/16-include.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# include
|
|
4
4
|
|
|
5
|
-
Use `tt-include` to include several config files into your main config file.
|
|
5
|
+
Use `tt-include` configuration param to include several config files into your main config file.
|
|
6
|
+
|
|
7
|
+
## Description
|
|
6
8
|
|
|
7
9
|
Until now, all the examples we have seen use one configuration file (`config.yaml`) that contain all the parameters required by the test. It is possible to save configuration distributed among several files.
|
|
8
10
|
|
|
@@ -18,9 +20,11 @@ Suppose we have the following file structure.
|
|
|
18
20
|
└── start.rb
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
`config.yaml` will be the main config file.
|
|
23
|
+
`config.yaml` will be the main config file. Then we define `tt_include` parameter with a folder wich contains more configuration files.
|
|
24
|
+
|
|
25
|
+
In this example the contents of all files into `moreconfigfiles` folder will be included when reading the config parameters:
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
## Config files
|
|
24
28
|
|
|
25
29
|
```yaml
|
|
26
30
|
---
|
|
@@ -30,19 +34,6 @@ In this example the contents of all files in `moreconfigfiles` folder will be in
|
|
|
30
34
|
:cases:
|
|
31
35
|
```
|
|
32
36
|
|
|
33
|
-
If we execute the test we will see that 3 cases are processed. Which are defined in the files `file01.yaml`, `02/file02.yaml` and `file03.yml`.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
CASE RESULTS
|
|
38
|
-
+------+---------+-------+-------+
|
|
39
|
-
| CASE | MEMBERS | GRADE | STATE |
|
|
40
|
-
| 01 | file02 | 0.0 | ? |
|
|
41
|
-
| 02 | file01 | 100.0 | ✔ |
|
|
42
|
-
| 03 | file03 | 0.0 | ? |
|
|
43
|
-
+------+---------+-------+-------+
|
|
44
|
-
```
|
|
45
|
-
|
|
46
37
|
Config files into `moreconfigfiles` folder:
|
|
47
38
|
|
|
48
39
|
```yaml
|
|
@@ -62,3 +53,17 @@ Config files into `moreconfigfiles` folder:
|
|
|
62
53
|
:tt_members: file03
|
|
63
54
|
:username: vader
|
|
64
55
|
```
|
|
56
|
+
|
|
57
|
+
## Output
|
|
58
|
+
|
|
59
|
+
If we execute the test we will see that 3 cases are processed. Which are defined in the files `file01.yaml`, `02/file02.yaml` and `file03.yml`.
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
CASE RESULTS
|
|
63
|
+
+------+---------+-------+-------+
|
|
64
|
+
| CASE | MEMBERS | GRADE | STATE |
|
|
65
|
+
| 01 | file02 | 0.0 | ? |
|
|
66
|
+
| 02 | file01 | 100.0 | ✔ |
|
|
67
|
+
| 03 | file03 | 0.0 | ? |
|
|
68
|
+
+------+---------+-------+-------+
|
|
69
|
+
```
|
data/docs/learn/17-alias.md
CHANGED
data/docs/learn/18-log.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[<< back](README.md)
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# log
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`log TEXT`, save TEXT into output report.
|
|
6
6
|
|
|
7
|
-
Example
|
|
7
|
+
## Example
|
|
8
8
|
|
|
9
9
|
```ruby
|
|
10
10
|
group "Learning about log messages" do
|
|
@@ -21,6 +21,8 @@ group "Learning about log messages" do
|
|
|
21
21
|
end
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
## Output
|
|
25
|
+
|
|
24
26
|
Content of `var/18-log/case-01.txt` file.
|
|
25
27
|
|
|
26
28
|
```
|
data/docs/learn/19-read_vars.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
To get paramm values from the configuration file we already have the `get` statement. Example, to read `dirname` we do `get(:dirname)`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Example 1: get
|
|
8
|
+
|
|
9
|
+
Using `get` to get/read values from config file.
|
|
8
10
|
|
|
9
11
|
```ruby
|
|
10
12
|
# "get(:dirname)" reads dirname var from config file
|
|
@@ -15,7 +17,9 @@ To get paramm values from the configuration file we already have the `get` state
|
|
|
15
17
|
|
|
16
18
|
Since the "get" instruction is frequently used, It is good to have a fast path. Let's see another shorter way to read variables using the "_" operator.
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
## Example 2: `_VARNAME`
|
|
21
|
+
|
|
22
|
+
Using `_VARNAME` to get/read values from config file.
|
|
19
23
|
|
|
20
24
|
```ruby
|
|
21
25
|
# "_dirname" is equivalet to "get(:dirname)"
|
|
@@ -26,7 +30,7 @@ Since the "get" instruction is frequently used, It is good to have a fast path.
|
|
|
26
30
|
|
|
27
31
|
The Teuton language is a DSL built on top of the Ruby programming language, so we can also use variables like any programming language.
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
## Example 3: Using variables
|
|
30
34
|
|
|
31
35
|
```ruby
|
|
32
36
|
# "dirname" is a variable
|
data/docs/learn/20-macros.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Macros is a technique to make it easier to write and reuse code.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Example
|
|
8
8
|
|
|
9
9
|
* We start from a set of repeated targets.
|
|
10
10
|
|
|
@@ -22,7 +22,7 @@ run "id david"
|
|
|
22
22
|
expect_one "david"
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
*
|
|
25
|
+
* So we define a macro with the repeated block:
|
|
26
26
|
|
|
27
27
|
```ruby
|
|
28
28
|
define_macro "user_exists", :name do
|
|
@@ -32,7 +32,7 @@ define_macro "user_exists", :name do
|
|
|
32
32
|
end
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
*
|
|
35
|
+
* Then replace the previous targets with macro calls.
|
|
36
36
|
|
|
37
37
|
```ruby
|
|
38
38
|
user_exists(name: "fran")
|
|
@@ -40,7 +40,9 @@ user_exists(name: "root")
|
|
|
40
40
|
user_exists(name: "david")
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
## Invoking macros
|
|
44
|
+
|
|
45
|
+
There are 3 ways to invoke the macro:
|
|
44
46
|
|
|
45
47
|
```ruby
|
|
46
48
|
user_exists(name: "fran")
|
data/docs/learn/21-exit_codes.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# Example: exit_codes
|
|
4
4
|
|
|
5
|
-
`result` stores information from the last command executed by a "run" action. [Offers many functions](../dsl/
|
|
5
|
+
`result` stores information from the last command executed by a "run" action. [Offers many functions](../dsl/result.md)) that transforms output data, and also exitcode is captured.
|
|
6
6
|
|
|
7
|
-
## Example
|
|
7
|
+
## Example 1: ok and fail
|
|
8
8
|
|
|
9
9
|
```ruby
|
|
10
10
|
target "Exist user root (exit code ok)"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
expect_exit 1
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Example 2: range and array
|
|
20
20
|
|
|
21
21
|
```ruby
|
|
22
22
|
target "Using a range"
|
data/docs/learn/22-result.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
Sometimes it can be useful to look at the information returned by the "run" command. For this we use the **"result" object**.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Example 1
|
|
8
|
+
|
|
9
|
+
In this example we run the "hostname" command on the machine and capture its output using "result". We'll use that value to make sure there isn't a user named as host name.
|
|
8
10
|
|
|
9
11
|
```ruby
|
|
10
12
|
group "Using result object" do
|
|
@@ -18,7 +20,9 @@ group "Using result object" do
|
|
|
18
20
|
end
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
## Example 2
|
|
24
|
+
|
|
25
|
+
When we are debugging our test and we want to see the content of the "result" object on the screen, we will use `result.debug`.
|
|
22
26
|
|
|
23
27
|
```ruby
|
|
24
28
|
group "Checking users" do
|
|
@@ -33,4 +37,4 @@ group "Checking users" do
|
|
|
33
37
|
end
|
|
34
38
|
```
|
|
35
39
|
|
|
36
|
-
> More information about [result](../dsl/
|
|
40
|
+
> More information about [result](../dsl/result.md) keyword.
|