test-sideex-webservice v0.8.8-1
SideeX WebService
SideeX WebService is a tool that supports playing SideeX-recorded test cases through SideeX WebService Web API. This document introduces SideeX WebService Web API and describes how to use SideeX WebService Client API to invoke the Web API. If you want to invoke SideeX WebService in Jenkins, refer to SideeX Plugin for Jenkins.
The architecture of SideeX WebService
Step 1 - Start Selenium Standalone Server
- Download Selenium Standalone Server (Tested version: 3.141.59)
- Download the the drivers that you'd like to test
- Open the terminal and switch to the path where you save the
selenium-server-standalone-{version}.jar
and the drivers - Run
java -jar selenium-server-standalone-{version}.jar
:::info Note that, Selenium Standalone Server and Node.js can be run in Docker containers. :::
Step 2 - Start SideeX WebService
- Download SideeX Webservice
- Unzip sideex-webservice-3.x.x.zip
- Open the terminal and switch to the path where you save the
sideex-webservice.js
- Run
node sideex-webservice.js --config {CONFIG_FILE_PATH}
. See Appendix A for the config file format. The following code show a simple WebService config file example (serviceconfig.json
).
{
"webservice": {
"server": {
"port": 50000,
},
"publicURL": {
"hostname": "127.0.0.1",
"port": 50000
},
"testReportExpireTime": 24
}
}
:::info Note that, SideeX WebService can be run in a Docker container. See Appendix C.
:::
Step 3 - Prepare a test case zip file
Prepare a zip file containing test case information. A zip file should at leaset contain a config.json and a suites folder. A variables folder and an i18n folder are optional.
testcase.zip
│ config.json
├───suites
│ Test_Suite_1.html
│ ...
├───variables
│ Global_Variables.json
│ ...
├───i18n
ja.json
zh_TW.json
...
Step 4 - Running the test case file
There are three ways to run the test case zip file: 1. Using SideeX WebService Web API 2. Using SideeX WebService Client API for Java | Python | Node.js 3. Using SideeX Plugin for Jenkins
Appendix A - SideeX WebService Config File Format
An example WebService config file: serviceconfig.json
{
"webservice": {
"server": {
"port": 50000,
"ssl": {
"active": true,
"privateKey": "your_private_key",
"certificate": "your_certificate"
}
},
"publicURL": {
"hostname": "127.0.0.1",
"port": 50000
},
"testReportExpireTime": 0
},
"mail": {
"active": 0,
"configs": {
"transport": {
"host": "smtp.gmail.com",
"port": 465,
"secure": true,
"auth": {
"user": "xxxx@gmail.com",
"pass": "your_password"
}
}
},
"mailer": {
"from": "\"your_title\" <xxxx@gmail.com>",
"to": "xxxx1@gmail.com, xxxx2@gmail.com",
"subject": "The test reports generated by SideeX WebService",
"html": "<p>Type your own mail body here</p>"
}
},
"slack": {
"active": 0,
"configs": {
"token": "your_slack_token",
"channel": "your_channel",
"text": "Here comes the test reports generated by SideeX WebService"
}
},
"line": {
"active": 0,
"configs": {
"token": "your_line_notify_token"
"text": "Here comes the test reports generated by SideeX WebService"
}
}
}
Description
webservice
- server
- port
- Description: Set server port
- Value: A number
- Default:
50000
- ssl
- active
- Description: Set server ssl
- Value: boolean
- Default:
false
- privateKey
- Description: Set private key file path
- Value: A string
- Default:
""
- certificate
- Description: Set certificate file path
- Value: A string
- Default:
""
- active
- protocal
- Description: Set server protocal
- Value: boolean
- Default:
false
- port
publicURL
- hostname
- Description:
- The IP address of the SideeX WebService server.
- If the SideeX WebService server runs as a Docker container, it should be host's IP address.
- Value: A string
- Default:
"127.0.0.1"
- Description:
- port
- Description:
- The port number of the SideeX WebService server.
- If the SideeX WebService server runs as a Docker container, it should be the host's port number mapped to the container.
- Value: A number
- Default:
50000
- Description:
- hostname
testReportExpireTime :::info This attribute can be overwritten by the client's config.json :::
- Description:
- The expiration time for deleting each generated test report.
0
: Never delete a test reportn
: Delete a test report n hours later after the report is generated
- Value: A positive integer (in hours)
- Default:
0
- Description:
- server
- mail
Sending reports via an SMTP server. Note that, if you use Gmail as your SMTP server, you need to create an application password first.
:::info
All or parts of the following attributes can be overwritten by the client's config.json
:::
- active
- Description
-
0
: No sending -1
: Sending on errors -2
: Always sending - Value:0
,1
or2
- Default:0
- configs - transport - Description: Refer to the SMTP Transport config - Value: For example:``` { "host": "smtp.gmail.com", "port": 465, "secure": true, "auth": { "user": "xxxx@gmail.com", "pass": "your_password" } } ``` - Default: `undefined` - **configs** - transport - Description: Refer to the [Message](https://nodemailer.com/message/) config - Value: For example: ``` { "from": "\"your_title\" <xxxx@gmail.com>", "to": "xxxx1@gmail.com, xxxx2@gmail.com", "subject": "The test reports generated by SideeX Runner", "html": "<p>Type your own mail body here</p>" } ``` - Default: `undefined`
- slack
Sending reports via Slack. You have to prepare a Slack token and channel at first.
:::info
All or parts of the following attributes can be overwritten by the client's config.json
:::
- active
- Description
-
0
: No sending -1
: Sending on errors -2
: Always sending - Value:0
,1
or2
- Default:0
- configs - token - Description: The token of the slack app - Value: A string - Default:""
- channel - Description: The slack workspaces channels - Value: A string - Default:""
- text - Description: The text showing in front of the test report summary - Value: A string - Default:""
- line
Sending reports via Line Notify. You have to prepare a Line Notify token at first.
:::info
All or parts of the following attributes can be overwritten by the client's config.json
:::
- active
- Description
-
0
: No sending -1
: Sending on errors -2
: Always sending - Value:0
,1
or2
- Default:2
- configs - token - Description: The token of the Line Notify - Value: A string - Default:""
- text - Description: The text showing in front of the test report summary - Value: A string - Default:""
Appendix B - SideeX WebService Client Config File Format
The config file format is the same as the one for SideeX Runner, except the followings:
input
,report.path
,webdriver.i18n
will be ignored by SideeX WebService- A new attribute
testReportExpireTime
is added. This attibute indicates the expiration time for deleting the generated test report. If the attribute is set in the client config file, it will overwrite the one in the WebService config file
An Example WebService Client Config File: config.json
{
"play": {
"mode": 2,
"entry": "",
"noLog": false,
"speed": 5,
"period": {
"time": -1,
"maxNum": -1
}
},
"report": {
"type":"html",
"snapshot": 2,
"snapshotQuality": 2
},
"webdriver": {
"configs": [
{
"serverUrl": "http://localhost:4444",
"type": "selenium",
"browsers":[
{
"active": true,
"capability": {
"browserName": "chrome",
"goog:chromeOptions": {
"args": [
"headless",
"disable-gpu",
"window-size=1080,720",
"no-sandbox"
]
}
}
},
{
"active": true,
"capability": {
"browserName": "firefox",
"moz:firefoxOptions": {
"args": [
"-headless",
"-disable-gpu",
"-window-size=1080,720"
]
}
}
}
]
}
]
},
"webservice": {
"testReportExpireTime": 24
},
"mail": {
"active": 2,
"configs": {
"mailer": {
"from": "\"your_title\" <xxxx@gmail.com>",
"to": "xxxx1@gmail.com, xxxx2@gmail.com",
"subject": "The test reports generated by SideeX Runner",
"html": "<p>Type your own mail body here</p>"
}
}
},
"slack": {
"active": 2,
"configs": {
"token": "your_slack_token",
"channel": "your_channel",
"text": "Here comes the test reports generated by SideeX Runner"
}
},
"line": {
"active": 2,
"configs": {
"token": "your_line_notify_token"
"text": "Here comes the test reports generated by SideeX WebService"
}
}
}
Appendix C - Running SideeX WebService and Selenium Server on Docker
The following example shows how to run SideeX WebService container and Selenium Standalone Server/Hub containers on the same host.
Step 1 - Download and Run Docker images of Selenium Standalone Server Hub and Node
More information about the Selenium Docker can be found at https://github.com/SeleniumHQ/docker-selenium
Download and run Selenium Hub and Node
$ docker run -d -p 4444:4444 --name selenium-hub selenium/hub
$ docker run -d -P -p 5900:5900 --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-chrome-debug
$ docker run -d -P -p 5901:5900 --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-firefox-debug
Step 2 - Download and Run SideeX WebService Docker image
- Create a serviceconfig.json file as Appendix A and a test-suites folder. This folder will be shared with the SideeX WebService container for temporarily saving the test cases and reports while test execution.
- Download and run SideeX WebService Docker image
$ docker run -d -P -p 50000:50000 --link selenium-hub:hub -v $(pwd)/serviceconfig.json:/opt/sideex-webservice/serviceconfig.json -v $(pwd)/test-suites:/opt/sideex-webservice/test-suites sideex/sideex-webservice
- In the client config file, set the webdriver.configs.serverUrl as follows.
{ "webdriver": { "configs": [ { "serverUrl": "http://{The IP of the host of the Selenium Hub container}:{The host's port mapped to the container}", "type": "selenium", "browsers":[ { "active": true, "capability": { "browserName": "chrome" } } ] } ] } }
Step 3 - Monitoring the SideeX WebService Container
$ docker logs -f <SideeX-WebService-container-name>