[Security Solution] Make Cypress tests for rules driven by code instead of data #153692
Labels
performance
refactoring
Team:Detection Rule Management
Security Detection Rule Management Team
Team:Detections and Resp
Security Detection Response Team
Team: SecuritySolution
Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.
technical debt
Improvement of the software architecture and operational architecture
test_ui_functional
test
Epic: #153633
Related to: (comment, comment, comment)
Summary
Make Cypress tests for rules driven by code instead of test data. Get rid of optional properties in data. This is supposed to reduce flakiness, increase speed, and improve the maintainability of our Cypress tests.
Our e2e tests are driven by test data. Whatever is or is not in the data (e.g. an instance of
CustomRule
) will determine what actions will be taken in the UI. Example:This approach has a few downsides:
fillScheduleRuleAndContinue
. This is commonly considered a bad practice in any automated tests because it increases complexity and non-determinism.The suggestion is to make tests driven by code instead of data. By using single-purpose functions (Cypress tasks, commands, etc) and combining them into higher-order functions, tests will be implementing the exact logic each of them needs.
With that in place, test data can become just normal mock data where you normally have default values for properties you don't need.
Going back to the optional properties like
customQuery
andrunsEvery
- they all will be required and have some default values. Each test will decide:The text was updated successfully, but these errors were encountered: