Testing Java Chat Application

I developed a basic chat application in Java. It consists of a server and several clients. The server constantly monitors incoming messages and sends them to all clients. The client consists of a Swing GUI with a text area (for messages sent by the server and other clients), a text field (for sending text messages) and a button (SEND). The client also constantly monitors incoming messages from other clients (through the Server). This is achieved using Threads and Listen Lists, and the application works as expected.

But, how do I get unit testing of my chat application? Since the methods include establishing a connection to the server and sending / receiving messages from the server, I am not sure that these methods should be checked per unit. In my opinion, Unit Testing should not be performed for tasks such as connecting to a database or network.

A few test cases that I could come up with:
1) The maximum limit of the text field
2) The client can connect to the Server
3) The server can connect to the client
4) The client can send a message
5) The client can receive a message
6) The server can send messages
7) The server can receive a message
8) The server can accept connections from several clients

- , . ?

+3
3

.

- mock objects, ( ) ( ).

, , , , , - .. , , .

Java Mockito mocking framework.

+5

API , . Swing . swingUnit Swing.

+2

7 Beautiful Testing XMPP. . :

XMPP - : , . , , , , . . , . , XMPP , XMPP , . , , .

+2
source

Source: https://habr.com/ru/post/1742846/


All Articles