Add e2e relationship tests for pre-GA validation#152
Conversation
- Add tests/e2e/test_relationships_e2e.py with 11 curated e2e tests covering: - 1:N core API lifecycle (create, get, delete) - 1:N convenience API (create_lookup_field to system table) - N:N lifecycle and nonexistent returns None - Data through relationships (@odata.bind, $expand, $filter, update binding) - Cascade behaviors (Restrict blocks delete, Cascade deletes children) - Type detection (get_relationship distinguishes 1:N vs N:N) - Add relationship testing to examples/basic/functional_testing.py - Configure pytest to exclude e2e from default run (requires DATAVERSE_URL env var) - E2e tests run with: DATAVERSE_URL=https://yourorg.crm.dynamics.com pytest tests/e2e/ -v -s
There was a problem hiding this comment.
Pull request overview
Adds a live-environment end-to-end (e2e) test suite to validate the Dataverse relationships API lifecycle prior to GA, plus updates local tooling/docs so unit tests remain the default.
Changes:
- Introduces
tests/e2e/test_relationships_e2e.pywith relationship lifecycle, data-through-relationship, and cascade behavior validation against a real Dataverse org. - Expands
examples/basic/functional_testing.pywith a new relationship testing section and retry helpers. - Updates
pyproject.tomlpytest configuration so defaultpytestruns onlytests/unit(e2e requires explicit invocation).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| tests/e2e/test_relationships_e2e.py | New live-org e2e suite validating 1:N, N:N, relationship-driven data ops, cascade behaviors, and type detection. |
| tests/e2e/init.py | Adds package marker for the new e2e tests directory. |
| examples/basic/functional_testing.py | Adds relationship functional testing workflow and retry helper in the example script. |
| pyproject.toml | Configures pytest default discovery to run unit tests only. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
- Switch all table/column/relationship names from test_ to new_ prefix (follows Dataverse convention for custom entity publisher prefix) - Use PascalCase nav prop for @odata.bind and \ (case-sensitive) - Use lowercase attribute logical name for _xxx_value in \/\ - Replace time.sleep() with _wait_for_lookup_ready() polling helper - Replace cascade delete time.sleep() with retry polling for 404 - Add pytestmark = pytest.mark.e2e and register marker in pyproject.toml - Close DataverseClient in fixture teardown - Read DATAVERSE_URL lazily for late-set env vars Validated: all 30 .scratch/ e2e tests pass (25 original + 5 fixed) Validated: all 11 repo e2e tests collected, 398 unit tests pass
This reverts commit 8f79ebe.
There was a problem hiding this comment.
Pull request overview
Adds a new end-to-end (live Dataverse) test suite to validate the full relationship API lifecycle (1:N, N:N, lookup helper, data operations via relationships, cascade behaviors) as part of pre-GA verification for the relationships feature set.
Changes:
- Added
tests/e2e/test_relationships_e2e.pywith 11 live-environment relationship e2e tests and supporting retry/wait helpers. - Updated
examples/basic/functional_testing.pyto include an interactive relationship testing section (create/get/delete for 1:N, lookup helper, and N:N). - Updated
pyproject.tomlpytest config to default to unit tests only and to register thee2emarker.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/e2e/test_relationships_e2e.py | New live Dataverse e2e suite validating relationship CRUD, data operations via relationships, and cascade behavior. |
| tests/e2e/init.py | Adds package marker for the new e2e tests directory. |
| pyproject.toml | Configures pytest to run unit tests by default and registers the e2e marker. |
| examples/basic/functional_testing.py | Extends functional testing script with interactive relationship lifecycle checks and retry helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
… in _wait_for_table
Summary
Add end-to-end relationship tests that validate the full relationship API lifecycle against a live Dataverse environment. This is the primary pre-GA validation for Tim's relationship PRs (#88, #105, #114).
Changes
New:
tests/e2e/test_relationships_e2e.py11 curated e2e tests covering:
TestOneToManyCoreTestLookupFieldcreate_lookup_fieldto system tableTestManyToManyTestDataThroughRelationships@odata.bind,$expand,$filteron lookup, update bindingTestCascadeBehaviorsTestTypeDetectionget_relationshipdistinguishes 1:N vs N:NUpdated:
examples/basic/functional_testing.pyUpdated:
pyproject.toml[tool.pytest.ini_options]withtestpaths = ["tests/unit"]pytestruns only unit tests; e2e tests require explicit invocationHow to run e2e tests
The tests authenticate via
InteractiveBrowserCredentialand create/delete temporary tables (prefixedtest_E2E*).E2E Test Results (from
.scratch/comprehensive suite)Ran 30 tests against
https://aurorabapenv71aff.crm10.dynamics.com:$expandneeds server-assigned nav prop)IsValidForAdvancedFindrequiresBooleanManagedPropertycomplex typeFinding: SDK inconsistency to address before GA
create_one_to_many_relationship()returnslookup_schema_nameas the user-provided SchemaName, but$expandrequires the server-assignedReferencingEntityNavigationPropertyName(which may differ in casing). The e2e tests work around this by callingget_relationship()after create to get the correct nav prop name. This should be harmonized before GA.Checklist
pytestexcludes e2e (runs unit only)