<!--
{
  "documentType" : "article",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/nsexception-assertions",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "NSException Assertions"
}
-->

# NSException Assertions

Check whether a function call throws, or doesn’t throw, an exception.

## Topics

### Testing for Exceptions

[`XCTAssertThrows`](/documentation/XCTest/XCTAssertThrows)

Asserts that an expression throws an `NSException`.

[`XCTAssertThrowsSpecific`](/documentation/XCTest/XCTAssertThrowsSpecific)

Asserts that an expression throws a specific `NSException`.

[`XCTAssertThrowsSpecificNamed`](/documentation/XCTest/XCTAssertThrowsSpecificNamed)

Asserts that an expression throws a specific NSException with a specific name.

[`XCTAssertNoThrow`](/documentation/XCTest/XCTAssertNoThrow)

Asserts that an expression doesn’t throw an `NSException`.

[`XCTAssertNoThrowSpecific`](/documentation/XCTest/XCTAssertNoThrowSpecific)

Asserts that an expression doesn’t throw a specific `NSException`.

[`XCTAssertNoThrowSpecificNamed`](/documentation/XCTest/XCTAssertNoThrowSpecificNamed)

Asserts that an expression doesn’t throw a specific `NSException` with a specific name.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)