askvity

What is procedural test?

Published in Software Testing Concepts 3 mins read

A procedural test is a type of software test that focuses on a series of steps.

Based on the provided reference, procedural tests are characterized by defining and following a sequence of actions to verify the behavior of a system or component. This approach is often considered natural to write because it mirrors the way a user or another system might interact with the software step-by-step.

Understanding Procedural Tests

In the realm of software testing, different methodologies exist to describe how tests are structured and executed. Procedural testing is one such methodology, primarily concerned with the how – the specific steps taken to reach a certain state or outcome.

  • Core Concept: Following a predetermined sequence of operations.
  • Contrast: Unlike declarative tests, which focus on the desired state or output given specific inputs, procedural tests detail the process to get there.

The reference explicitly states: "Procedural tests focus on a series of steps". This highlights the sequential nature as the defining characteristic.

Procedural vs. Declarative Tests

The reference draws a direct comparison between procedural and declarative tests: "Procedural tests focus on a series of steps; declarative tests work from the input and states."

Feature Procedural Test Declarative Test
Primary Focus The series of steps or actions The desired input and states
How it Works Defines the process or sequence Defines the expected outcome
Readability Can be natural, mirrors user flow Can be more concise and clear
Maintenance Can be sensitive to changes in flow Can be more resilient to flow changes

While procedural tests are "natural to write" because they map directly to workflows, the reference suggests considering whether a declarative test might express the testing intent "more concisely and clearly."

Practical Considerations

Choosing between a procedural or declarative approach depends on the specific testing goal.

  • When Procedural Might Be Used:

    • Testing a specific user workflow that involves multiple distinct steps (e.g., filling out a multi-page form, completing a checkout process).
    • Verifying error handling at specific points within a sequence.
    • Automating interactions that closely mimic manual testing steps.
  • Potential Drawbacks:

    • Can become brittle if the UI or workflow steps change frequently.
    • Can be less clear about the ultimate goal compared to tests that state the desired end-state explicitly.

Conclusion

In summary, a procedural test defines and verifies software behavior by executing and asserting outcomes at various points within a specific, predefined sequence of steps. It contrasts with declarative testing which focuses on verifying the system's state based on inputs, often without specifying the exact path taken to reach that state.

Related Articles