What are some strategies for testing large state machines?

后端 未结 9 1676
刺人心
刺人心 2021-02-01 05:51

I inherited a large and fairly complex state machine. It has 31 possible states, all are really needed (big business process). It has the following inputs:

  • Enum: C
9条回答
  •  北恋
    北恋 (楼主)
    2021-02-01 06:15

    How many test do you think is needed to "completely" test function sum(int a, int b)? In c# it would be something like 18446744056529682436 tests... Much worse than in your case.

    I would suggest following:

    1. Test most possible situations, boundary conditions.
    2. Test some critical parts of your SUT separately.
    3. Add test cases when bugs found by QA or in production.

    In this particular case the best way is to test how system switches from one state to onother. Create DSL to test state machine and implement most frequent use cases using it. For Example:

    Start
      .UploadDocument("name1")
      .SendDocumentOnReviewTo("user1")
      .Review()
      .RejectWithComment("Not enough details")
      .AssertIsCompleted()
    

    The example of creating simple tests for flows is here: http://slmoloch.blogspot.com/2009/12/design-of-selenium-tests-for-aspnet_09.html

提交回复
热议问题