Menu

OS Independent Unit Tests

2012-02-03
2013-05-17
  • Alexander Senf

    Alexander Senf - 2012-02-03

    Hi,

    I am testing all my programs in both Windows and Unix settings, and I noticed two unit tests failing in Windows.

    To enable tests in both settings, the line (in TestEchoServer.test1 and TestEchoServerMultiClient.doClientCommunication)

                    String line=Util.readLine(client.getInputStream());

    Should be changed to something like this:

                    String os = System.getProperty("os.name").toLowerCase();
                    char terminatorChar = '\n';
                    if (os.indexOf("win") >= 0)
                        terminatorChar = '\r';
    String line=Util.readLine(client.getInputStream(), terminatorChar);

    This obviously won't work if the server runs in Windows and the client in Unix; but it helps with the unit tests, because client and server run on the same machine/OS.

    Thanks,
    Alexander

     
  • Bernd Schuller

    Bernd Schuller - 2012-02-06

    fixed, thanks!

    Bernd.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.