These are the test scenarios for coap_server to be run using the bbt tool.
They test cases where the server processes the command line and terminates.
You can install bbt with alr install bbt.
Use this command to run the tests: bbt coap_server_tests.md
- When I run
../bin/coap_server --version - Then I get no error
- And output contains
coap_server v0.
- When I run
../bin/coap_server --help - Then I get no error
- And output contains
Usage: coap_server
- When I run
../bin/coap_server --unknown-option - Then I get an error
- And output contains
Usage: coap_server
- When I run
../bin/coap_server -v 4 -u - Then I get an error
- And output contains
Unexpected option: -u
- When I run
../bin/coap_server -v fatal - Then I get an error
- And output contains
Invalid verbosity level
- When I run
../bin/coap_server -v 10 - Then I get an error
- And output contains
Verbosity level too high
- When I run
../bin/coap_server -z - Then I get an error
- And output contains
Invalid option: -z
- When I run
../bin/coap_server -p 100000 - Then I get an error
- And output contains
Invalid specified port
- When I run
../bin/coap_server -p 1234 -? 0 - Then I get an error
- And output contains
Invalid option: -?
These are the test scenarios for coap_server to be run using the bbt tool.
You can install bbt with alr install bbt.
Use this command to run the tests: bbt coap_server_tests.md
These scenarios require connectivity to a server running locally in this way:
coap_server
coap_client has to be visible in the PATH, because each scenario invokes it
directly.
This test has to be broken in two contains checks, because the ETAG option will be determined by the server, so we have to exclude it, and it is in the middle of the output.
- When I run
coap_client -v 4 coap://localhost/ - Then I get no error
- And the output contains
Method: GET
Scheme: coap
Host: localhost
Port: 5683
Path: /
Query:
REQUEST:
Option: URI_HOST
- Length: 9
- Value: localhost
Option: URI_PORT
- Length: 2
- Value: 5683
RESPONSE:
Server answered with success.
Content-Format: text/plain; charset=utf-8
Payload: This is a test server made with CoAP-SPARK
- When I run
coap_client coap://localhost - Then I get no error
- And output contains
This is a test server made with
- When I run
coap_client coap://localhost/ - Then I get no error
- And output contains
This is a test server made with
- When I run
coap_client coap://localhost:5683 - Then I get no error
- And output contains
This is a test server made with
- When I run
coap_client -m post -e "New resource" coap://localhost/test - Then I get no error
- When I run
coap_client -m get coap://localhost/test - Then I get no error
- And output contains
New resource
- When I run
coap_client -m post -e "New resource" coap://localhost/test - Then I get no error
- And output contains
Resource already exists
- When I run
coap_client -m get coap://127.0.0.1/ - Then I get no error
- And output contains
This is a test server made with
- When I run
coap_client coap://localhost:5683/test - Then I get no error
- And output contains
New resource
- When I run
coap_client -m post -e "New resource inside another" coap://localhost/test/inner - Then I get no error
- When I run
coap_client -m get coap://localhost/test/inner - Then I get no error
- And output contains
New resource inside another
- When I run
coap_client coap://localhost/this/does/not/exist - Then I get no error
- And the output is
4.04 Resource not found
- When I run
coap_client -m post -e "very long resource name" coap://localhost/123412341234123412341234 - Then I get no error
- When I run
coap_client coap://localhost/123412341234123412341234 - Then I get no error
- And the output contains
very long resource name
- When I run
coap_client -m get coap://localhost/hola - Then I get no error
- And output is
4.04 Resource not found
- When I run
coap_client -m patch -e "This is a test" coap://localhost/test - Then I get no error
- And output is
4.05 Method not supported
- When I run
coap_client -m delete coap://localhost/test - Then I get no error
- When I run
coap_client -m delete coap://localhost/test - Then I get no error
- And the output is
4.04 Resource not found
- When I run
coap_client -m get coap://localhost/test - Then I get no error
- And the output is
4.04 Resource not found