In order to use the sqlcmd utility to export test results in xml format it is necessary to both use the :XML ON directive and pass the -y0 flag to sqlcmd in order to get the full output. However, the :XML ON directive is not supported in the Linux version of sqlcmd.
As an alternative, casting to nvarchar(max) and using the -y0 flag works, including on Linux. However, tSQLt.XmlResultFormatter does not allow any way to do this cast. It is not possible via INSERT .. EXEC .., since FOR XML cannot be used within INSERT .. EXEC ...
In order to use the sqlcmd utility to export test results in xml format it is necessary to both use the
:XML ONdirective and pass the-y0flag tosqlcmdin order to get the full output. However, the:XML ONdirective is not supported in the Linux version ofsqlcmd.As an alternative, casting to
nvarchar(max)and using the-y0flag works, including on Linux. However, tSQLt.XmlResultFormatter does not allow any way to do this cast. It is not possible viaINSERT .. EXEC .., sinceFOR XMLcannot be used withinINSERT .. EXEC ...