GoEddie/tSQLt-TestAdapter

AgileSQLClub.tSQLtTestAdapter 0.59.0

Opened this issue · 3 comments

We are using this test adapter for TFS 2015 builds (VS2015 is installed on build machine).
The error appeared on test which returns empty select (just column names are returned as the test check how the sp acts when non existing value is provided).

The error message in build log:
2018-01-18T16:42:13.5425357Z Failed test_schema.test 03 provided non existing code should return empty data set
2018-01-18T16:42:13.5465375Z ##[error]Error Message:
2018-01-18T16:42:13.5475371Z ##[error]
2018-01-18T16:42:13.5485398Z ##[error]failure.message: Expecting to get a data reader with the response to: "exec tSQLt.RunWithXmlResults '[test_schema].[test 03 provided non existing code should return empty data set]'"
2018-01-18T16:42:13.5485398Z ##[error]

Note
The test was executed directly on Build machine SQL server using tSQLt.RunAll, no errors or failures were noticed. No failure details in [tSQLt].[TestResult] as well.

I had this same issue and had to remove all selects (changed select function to set variable = function) to get the test to work.

can you post an example test?

Approach below works, because empty output was inserted into global temp table which was created by Setup.sql, but if I remove INSERT INTO ##actual_results then the test fails with same error.

    -- Assemble
    DECLARE @ProfileId INT = 999,
            @CountryCode VARCHAR(4) = 'NE',
            @ExtractDate DATETIME = GETDATE();

    SELECT *
    INTO #expected_data
    FROM dbo.table;

    -- Act
    INSERT INTO ##actual_results
    EXEC dbo.get_data @ProfileId = @ProfileId, @CountryCode = @CountryCode, @ExtractDate = @ExtractDate;

    -- Assert
    SELECT *
    INTO #actual_data
    FROM dbo.table;

    EXEC tSQLt.AssertEqualsTable @Expected = N'#expected_data', @Actual = N'#actual_data';
    EXEC tSQLt.AssertEmptyTable @TableName = N'##actual_results';