tSQLt - Database Unit Testing for SQL Server

Database Unit Testing for SQL Server

  • Home
  • Docs
    • Documents
    • Quick Start
    • Articles
  • Training
  • Downloads
tSQLt » Documents » Assertions » AssertEqualsTableSchema

AssertEqualsTableSchema

Syntax

tSQLt.AssertEqualsTableSchema [@Expected = ] 'expected table name'
                            , [@Actual = ] 'actual table name'
                           [, [@FailMsg = ] 'message' ]

Arguments

[@Expected = ] expected table name
The name of a table with the expected columns (and data types). @Expected is NVARCHAR(MAX) with no default.
[@Actual = ] actual table name
The name of a table created as the result from processing during the test. @Actual is NVARCHAR(MAX) with no default.
[@FailMsg = ] ‘message’
Optional. String containing an additional failure message to be used if the expected and actual values are not equal. @FailMsg is NVARCHAR(MAX) with a default of ‘unexpected/missing resultset rows!’.

Return Code Values

Returns 0

Errors Raised

Raises a ‘failure’ error if the contents of the expected table and the actual table are not equal.

Result Sets

None

Overview

AssertEqualsTableSchema works like AssertEqualsTable, but instead of comparing the table contents, it compares the table compares the table schemata.

Under the covers, AssertEqualsTableSchema calls AssertEqualsTable on the table metadata. For details of how to interpret its output, check out the AssertEqualsTable documentation.

See Also

  • Fail
  • AssertResultSetsHaveSameMetaData
  • AssertObjectExists
  • AssertObjectDoesNotExist
  • AssertNotEquals
  • AssertLike
  • AssertEqualsTableSchema
  • AssertEqualsTable
  • AssertEqualsString
  • AssertEquals
  • AssertEmptyTable
Share and Enjoy:
  • FacebookFacebook
  • TwitterTwitter
  • LinkedInLinkedIn
  • RedditReddit
  • StumbleUponStumbleUpon
  • TechnoratiTechnorati
  • PrintPrint

Navigation

  • Join the conversation
  • Downloads
  • New Logo
  • Sponsors & Contributors
  • Release Notes
  • Articles
  • Training
  • How to get more out of tSQLt
  • Why you should use the tSQLt framework
  • Why you should unit test SQL Server Code
  • Full user guide
  • Documents
    • Quick Start
    • tSQLt Tutorial
    • tSQLt Keyboard Shortcuts
    • Test Creation and Execution
      • NewTestClass
      • DropClass
      • RunAll
      • Run
      • RenameClass
    • Assertions
      • AssertEmptyTable
      • AssertNotEquals
      • AssertObjectDoesNotExist
      • AssertEqualsTableSchema
      • AssertEquals
      • AssertEqualsString
      • AssertEqualsTable
      • AssertObjectExists
      • AssertResultSetsHaveSameMetaData
      • Fail
      • AssertLike
    • Expectations
      • ExpectException
      • ExpectNoException
    • Isolating Dependencies
      • FakeFunction
      • RemoveObjectIfExists
      • ApplyConstraint
      • SpyProcedure
      • FakeTable
      • ApplyTrigger
      • RemoveObject

Links

  • tSQLt on GitHub
  • tSQLt Mailing List
  • twitter hashtag (#tsqlt)
  • tSQLt tag on stackoverflow.com
  • SQL Server Community on Slack (#tsqlt)
  • #tSQLtLive on YouTube

Sponsors

sqlity.net
redgate.com

A sqlity.net llc Web Property. | ©2010 - 2020, All Rights Reserved. | Privacy Policy | Terms of Use