tSQLt.AssertEqualsTable order mismatch error

72 Views Asked by At

i am try to run one test, I got below error, So can you guys pls help me on this to fix this?

pub_id avg_price
0736 9.784
0877 15.41
1389 18.976
ALL 14.7662

    CREATE PROCEDURE DemoUnitTestClass.[testrepq1]
    AS
    BEGIN
    IF OBJECT_ID('actual') IS NOT NULL DROP TABLE actual;
    IF OBJECT_ID('expected') IS NOT NULL DROP TABLE expected;
    
    CREATE TABLE actual (
    pub_id varchar(10),
    avg_price varchar(10)
    );
    
    INSERT INTO actual (pub_id, avg_price) exec reptq1
    
    CREATE TABLE expected (
    pub_id varchar(10),
    avg_price varchar(10)
    );
    
    INSERT INTO expected (pub_id, avg_price) SELECT '0736','9.784';
    INSERT INTO expected (pub_id, avg_price) SELECT '0877','15.41';
    INSERT INTO expected (pub_id, avg_price) SELECT '1389','18.976';
    INSERT INTO expected (pub_id, avg_price) SELECT 'ALL','14.7662';
    
    EXEC tSQLt.AssertEqualsTable 'expected', 'actual';
    END;
    
    
    (2 rows affected)
    [DemoUnitTestClass].[testrepq1] failed: (Failure) Unexpected/missing resultset rows!
    |_m_|pub_id|avg_price|
    +---+------+---------+
    |  |1389  |18.98    |
    |>  |0736  |9.78     |
    |>  |ALL   |14.77    |
     
    +----------------------+
    |Test Execution Summary|
    +----------------------+
     
    |No|Test Case Name                 |Dur(ms)|Result |
    +--+-------------------------------+-------+-------+
    |1 |[DemoUnitTestClass].[testrepq1]|     14|Failure|

in rept1 i used order by id so it always return in order but this is failing the result because of order.

0

There are 0 best solutions below