 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
[12.0.167 BETA] - Unit testing |
|
This new feature will be awesome for speeding up unit testing in the database. Unfortunately, it has some issues yet. It worked with simple selects yielding simple results but failed when I tried it on a stored procedure that returns two result sets, one having 2 records (of 14 columns) and another one with a single record (of 6 columns). The results column contained an incomplete XML.
Just to make sure, I put those queries in the stored procedure into a separate unit test to see if it's the stored procedure that makes the difference, but no, it still truncated the contents of the results column. Its type was text, I changed it to varchar(max), alas to no avail. Then I noticed the length of the text in it. It was cut after the 255th character. I guess the variable that is used in pre-processing the results before inserting them into the SA_UNITTEST_LOG table is of incorrect type or insufficient length. Could you check that, please?
|
|
Mon Oct 04, 2021 5:17 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
 |
 |
The results column contained an incomplete XML. |
Do I understand correctly that the second result set returned a text value longer than 255 chars and that value got truncated within the XML saved? And when you execute the same procedure separately, you can see the complete value in the results? If my understanding is correct, the issue is in a bit different place, when retrieving results returned in unit tests it might be reading first 255 chars of text values to limit their size. I don't know if that is done on purpose. Please give me some time to find out how it's implemented.
|
|
Mon Oct 04, 2021 9:17 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
 |
 |
 |
 |
The results column contained an incomplete XML. |
Do I understand correctly that the second result set returned a text value longer than 255 chars and that value got truncated within the XML saved? |
No, the truncate is done as soon as the character count reaches 255. Even if that happens in the middle of the first result set, first row, third column. Nothing from the rest of the columns/rows/result sets is stored at all. I tried to paste it here but the XML properties are removed from the end result:
 |
 |
<xml>
<results>
<table>
<row>
<cell>5</cell>
<cell>f:\hcbck_datahouse</cell>
<cell>[DATAHOUSE].[dbo].[v_adatblokk_201
|
|
|
Mon Oct 04, 2021 9:57 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Got it. That's certainly a bug. But it might be related to a particular database driver type. Which one are you using?
I already created a ticket for that #SA0042127, just need to add database and driver details.
|
|
Mon Oct 04, 2021 11:04 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
The server I experimented with was an SQL Server 2012 SP1. The error manifested with ADO (Driver={SQL Server Native Client 11.0}). When I tried to run the test in an ODBC connection, it threw an error message:
 |
 |
2021-10-04 19:37:29 Unit testing started.
2021-10-04 19:37:29 Unit test "Plain unit test" started.
2021-10-04 19:37:29 Test case "Two simple selects" passed.
2021-10-04 19:37:29 Error binding column "START_TIME" for record 1. Bind: ODBC Error (0): SQLBindParameter
Client: 10.00.19041
Server: 11.00.3128
SQL State: HY104
[Microsoft][ODBC SQL Server Driver]Invalid precision value;
INSERT INTO [SA_UNITTEST_LOG] ([TEST_ID],[UNIT_TEST],[TEST_CASE],[ACTIVE],[STATUS],[START_TIME],[DURATION],[ERROR_MESSAGE],[RESULTS]) VALUES (?,?,?,?,?,?,?,?,?)
2021-10-04 19:37:29
|
On the other hand, when I run a test on a MariaDB server, it stored some 45k characters in the results column without any problem. So yes, this is likely to be related to the database driver type.
Meanwhile I've run into another issue, opening a new topic for that one.
|
|
Mon Oct 04, 2021 1:43 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|