locked
CppUnitTestFramework maximum fail message length 2.5 KB? RRS feed

  • Question

  • Hi,

    it seems that the length of a fail message in the native C++ test framework is very limited, to about 2.5 kilobyte? See this example:

    		TEST_METHOD(TestMethod1)
    		{
    			Assert::Fail(LR"(Call me Ishmael. Some years ago--never mind how long precisely--having
    little or no money in my purse, and nothing particular to interest me on
    shore, I thought I would sail about a little and see the watery part of
    the world. It is a way I have of driving off the spleen and regulating
    the circulation. Whenever I find myself growing grim about the mouth;
    whenever it is a damp, drizzly November in my soul; whenever I find
    myself involuntarily pausing before coffin warehouses, and bringing up
    the rear of every funeral I meet; and especially whenever my hypos get
    such an upper hand of me, that it requires a strong moral principle to
    prevent me from deliberately stepping into the street, and methodically
    knocking people's hats off--then, I account it high time to get to sea
    as soon as I can. This is my substitute for pistol and ball. With a
    philosophical flourish Cato throws himself upon his sword; I quietly
    take to the ship. There is nothing surprising in this. If they but knew
    it, almost all men in their degree, some time or other, cherish very
    nearly the same feelings towards the ocean with me.
    
    There now is your insular city of the Manhattoes, belted round by
    wharves as Indian isles by coral reefs--commerce surrounds it with
    her surf. Right and left, the streets take you waterward. Its extreme
    downtown is the battery, where that noble mole is washed by waves, and
    cooled by breezes, which a few hours previous were out of sight of land.
    Look at the crowds of water-gazers there.
    
    Circumambulate the city of a dreamy Sabbath afternoon. Go from Corlears
    Hook to Coenties Slip, and from thence, by Whitehall, northward. What
    do you see?--Posted like silent sentinels all around the town, stand
    thousands upon thousands of mortal men fixed in ocean reveries. Some
    leaning against the spiles; some seated upon the pier-heads; some
    looking over the bulwarks of ships from China; some high aloft in the
    rigging, as if striving to get a still better seaward peep. But these
    are all landsmen; of week days pent up in lath and plaster--tied to
    counters, nailed to benches, clinched to desks. How then is this? Are
    the green fields gone? What do they here?)");
    		}
    

    When I run this, either in the VS2017 GUI or with vstest.console, the error message is cut off at "pent up in la":

    C:\Users\rodeng\source\repos\TestCppTestExceptions\Debug>vstest.console TestCppTestExceptions.dll
    Microsoft (R) Test Execution Command Line Tool Version 15.0.26929.2
    Copyright (c) Microsoft Corporation.  All rights reserved.
    
    Starting test execution, please wait...
    Failed   TestMethod1
    Error Message:
       Assert failed. Call me Ishmael. Some years ago--never mind how long precisely--having
    little or no money in my purse, and nothing particular to interest me on
    shore, I thought I would sail about a little and see the watery part of
    the world. It is a way I have of driving off the spleen and regulating
    the circulation. Whenever I find myself growing grim about the mouth;
    whenever it is a damp, drizzly November in my soul; whenever I find
    myself involuntarily pausing before coffin warehouses, and bringing up
    the rear of every funeral I meet; and especially whenever my hypos get
    such an upper hand of me, that it requires a strong moral principle to
    prevent me from deliberately stepping into the street, and methodically
    knocking people's hats off--then, I account it high time to get to sea
    as soon as I can. This is my substitute for pistol and ball. With a
    philosophical flourish Cato throws himself upon his sword; I quietly
    take to the ship. There is nothing surprising in this. If they but knew
    it, almost all men in their degree, some time or other, cherish very
    nearly the same feelings towards the ocean with me.
    
    There now is your insular city of the Manhattoes, belted round by
    wharves as Indian isles by coral reefs--commerce surrounds it with
    her surf. Right and left, the streets take you waterward. Its extreme
    downtown is the battery, where that noble mole is washed by waves, and
    cooled by breezes, which a few hours previous were out of sight of land.
    Look at the crowds of water-gazers there.
    
    Circumambulate the city of a dreamy Sabbath afternoon. Go from Corlears
    Hook to Coenties Slip, and from thence, by Whitehall, northward. What
    do you see?--Posted like silent sentinels all around the town, stand
    thousands upon thousands of mortal men fixed in ocean reveries. Some
    leaning against the spiles; some seated upon the pier-heads; some
    looking over the bulwarks of ships from China; some high aloft in the
    rigging, as if striving to get a still better seaward peep. But these
    are all landsmen; of week days pent up in la
    Stack Trace:
            at TestCppTestExceptions::UnitTest1::TestMethod1() in c:\users\rodeng\source\repos\testcpptestexceptions\unittest1.cpp:line 48
    
    Total tests: 1. Passed: 0. Failed: 1. Skipped: 0.
    Test Run Failed.
    Test execution time: 0.7299 Seconds
    
    

    Is there a way to lift this restriction?

    I need longer message lengths, because exception messages from Hippomocks contain the list of all expectations, which is needed for proper error analysis.


    Wednesday, February 14, 2018 8:53 AM

All replies

  • Hi rodeng,

    Sorry for this brought your any inconvenience.

    I check your issue in my side, and I get the same length limit.

    Based on my understanding, this should be the CppUnitTestFramework output limit for strings, just like the maximum string length of C String Literals.

    If you want to this feature request, I suggest you could submit this feature request: https://visualstudio.uservoice.com/forums/121579-visual-studio

    The Visual Studio product team is listening to user voice there. You can send your idea there and people can vote. If you submit this suggestion, I hope you could post that link here, I will help you vote it.

    Thanks for your understanding.

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Judy ZhuY Monday, February 19, 2018 1:46 AM
    Thursday, February 15, 2018 7:35 AM