简体   繁体   English

客户端-服务器功能测试

[英]Client-Server functional tests

I am writing a client and server library for local IPC. 我正在为本地IPC编写客户端和服务器库。 Client and Server both has classes which make use of named pipes to send data between two processes. 客户端和服务器都有类,它们利用命名管道在两个进程之间发送数据。 I want to write functional test to test client-server libraries. 我想编写功能测试来测试客户端服务器库。

My idea is to create client in functionaltest, mock a server in a separate executable, launch server using CreateProcess and send data to server. 我的想法是在Functionaltest中创建客户端,在单独的可执行文件中模拟服务器,使用CreateProcess启动服务器并将数据发送到服务器。 But in such case I won't have any control on mock server and checking data sent by client cannot be validated on server. 但是在这种情况下,我将无法在模拟服务器上进行任何控制,并且无法在服务器上验证客户端发送的数据。

Can anyone suggest me how to write client server functional test so I can validate functionality of both modules. 谁能建议我如何编写客户端服务器功能测试,以便我可以验证两个模块的功能。

Here are couple of tests I'm thinking of, 1. Client connects to server. 这是我正在考虑的几个测试:1.客户端连接到服务器。 2. Client disconnects gracefully from server. 2.客户端与服务器正常断开连接。 3. Client sends some data to server. 3.客户端向服务器发送一些数据。 4. Server disconnects client connection selectively. 4.服务器有选择地断开客户端连接。 5. Server shutdown/client shutdown 6. etc. 5.服务器关闭/客户端关闭6.等等。

Thanks, Ajay 谢谢阿杰

为了进行测试,请使用单独的线程在同一进程中运行客户端和服务器代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM