30520c9513
Icetea missing test doc |
||
---|---|---|
.. | ||
README.md | ||
SOCKET_BIND_PORT.py | ||
TCPSERVER_ACCEPT.py | ||
TCPSOCKET_ACCEPT.py | ||
TCPSOCKET_ECHOTEST_BURST_SHORT.py | ||
__init__.py | ||
interface.py |
README.md
##Netsocket tests
This folder contains netsocket tests for Icetea
The tests located in this folder are dependent of the application socket_app
The test cases in this folder are similar to Network Socket test plan.
Icetea test cases are processed by passing commands through the mbed-client-cli
command line. It is possible to manually replicate most test cases by following the instructions below.
In test cases with more than one device under test (DUT) the target device is given in the instructions as DUT1, DUT2 or DUT3.
Test cases
SOCKET_BIND_PORT
Description:
Open and bind port.
Preconditions:
- Network interface and stack are initialized.
- Network connection is up.
Test steps:
- Create a object by calling
socket new TCPSocket
on device - Call
socket TCPSocket open
- Call
socket TCPSocket bind port <any non-used port number>
- Destroy socket
socket TCPSocket delete
- Create a object by calling
socket new UDPSocket
on device - Call
socket UDPSocket open
- Call
socket UDPSocket bind port <any non-used port number>
- Destroy socket
socket UDPSocket delete
Expected result:
The test exits with status PASS
without timeouts.
TCPSERVER_ACCEPT
Description:
Test that TCPServer::bind()
, TCPServer::listen()
and TCPServer::accept()
works.
Requires 2 devices.
Preconditions:
- Network interface and stack are initialized.
- Network connection is up.
Test steps:
- DUT1:
socket new TCPServer
Command returns server base socket ID - DUT1:
socket <base socket ID> open)
- DUT1:
socket <base socket ID> bind port <port>)
- DUT1:
socket <base socket ID> listen)
- DUT1: Create a new TCPSocket
socket new TCPSocket
Command returns server socket ID - DUT1:
socket <server socket ID> open
- DUT2: Create a new TCPSocket
socket new TCPSocket
Command returns client socket ID - DUT2:
socket <client socket ID> open
- DUT2:
socket <client socket ID> connect <dut1 IP> <port>
- DUT1:
socket <base socket id> accept <server socket id>
Command should return new socket ID - DUT1:
socket <new socket ID> send hello
- DUT2:
socket <client socket ID> recv 5
- DUT2: Verify that it received "hello"
- Destroy all sockets.
Expected result:
On DUT1 accept() call blocks until connection is received. Duration of call verified to be within threshold.
The test exits with status PASS
without timeouts.
TCPSOCKET_ECHOTEST_BURST_SHORT
Description:
Send burst of packets to echo server and read incoming packets back.
Preconditions:
- Network interface and stack are initialized.
- Network connection is up.
- TCPSocket is open.
Test steps:
- Call
socket <socket ID> open
- Call
socket <socket ID> connect echo.mbedcloudtesting.com 7
- Create 5 randomized strings (100, 200, 300, 120 and 500 characters)
- Send each string
socket <socket ID> send <string>
- Receive total size of sent data
socket <socket ID> recv <total size>
- Verify that received data is identical to sent data
- Repeat 2 times
- Destroy the socket
Expected result:
All send() calls should return the packet size.
The received data matches the sent data.
The test exits with status PASS
without timeouts.