Search includes SOSL, global search, list view search, search components.
Test scenarios:
Functional:
- Exact match search.
- Wildcard search.
- Stemming (search "running" finds "ran").
- Fuzzy match.
- Multi-language.
- Empty / null results.
Performance:
- Search across millions of records.
- Concurrent search load.
Permissions:
- User sees only what they have access to.
- FLS enforced — hidden fields not searched.
Indexing:
- Recently created records eventually indexed (typical 3-5 minute delay).
- Custom fields indexable if marked External Id or via Custom Indexes.
SOSL specifics:
- Searches multiple objects.
- Returns nested lists.
- Test query correctness.
Test approach:
- Apex tests for SOSL queries.
- Manual testing of UI search.
- Performance tests at scale.
Common pitfalls:
- Newly created records not indexed — flaky tests.
- Permission edge cases — search shows what shouldn't.
- Multi-language not tested.
Senior insight: search testing is non-trivial. Indexing delays and permission complexity surface bugs.
