Class TestcaseComputationStrategy
java.lang.Object
org.chenile.workflow.testcases.TestcaseComputationStrategy
Construct a flow without self transitions that goes forward till the last state
has no transitions or alternatively has transitions that only go backwards to
already visited states.
This class returns multiple test cases each with their own flow. We can use that to construct multiple test scenarios.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddToNext(Transition transition, State newState, List<Testcase> testcaseList, Set<State> visitedStates) Obtain the next state for the given transition.cachedComputePaths(State state, Set<State> visitedStates) private voidcomputeActivitiesPath(StateDescriptor sd, List<Testcase> testcaseList, Set<State> visitedStates) private voidcomputeActivitiesWithAutoComputationChecker(StateDescriptor sd, List<Testcase> testcaseList, AutomaticStateDescriptor asd, Set<State> visitedStates) This method computes the path for states that have concurrent activities culminating in an auto state.computePaths(State state, Set<State> visitedStates) dropAutoStates(List<Testcase> testcases) If the test case happens to have auto states they need to be simply dropped from the test case.private voidAdds useful information to the test cases such as an ID, first flag etc.private voidnoActivities(StateDescriptor sd, State state, List<Testcase> testcaseList, Set<State> visitedStates) private voidtoTestcases(State state)
-
Field Details
-
stmFlowStore
-
activityChecker
-
-
Constructor Details
-
TestcaseComputationStrategy
TestcaseComputationStrategy(STMFlowStore flowStore)
-
-
Method Details
-
toTestcases
-
enhance
-
cachedComputePaths
-
dropAutoStates
If the test case happens to have auto states they need to be simply dropped from the test case. Store the old steps in allSteps so that consumers who want all the steps inclusive of auto states can access them.- Parameters:
testcases- - List of test cases to update- Returns:
- the altered test cases with the auto states dropped
-
computePaths
-
noActivities
-
addToNext
private void addToNext(Transition transition, State newState, List<Testcase> testcaseList, Set<State> visitedStates) Obtain the next state for the given transition. Get all the testcases that are associated with the next state and then add this transition to each of those. Return the next state transitions with this one added. If no transitions are found for the next state then create a new test case with just this transition in it.- Parameters:
transition- the transition for which the next state needs to be obtainedtestcaseList- - an empty list to which the test cases have to be added.
-
computeActivitiesPath
private void computeActivitiesPath(StateDescriptor sd, List<Testcase> testcaseList, Set<State> visitedStates) -
process
-
computeActivitiesWithAutoComputationChecker
private void computeActivitiesWithAutoComputationChecker(StateDescriptor sd, List<Testcase> testcaseList, AutomaticStateDescriptor asd, Set<State> visitedStates) This method computes the path for states that have concurrent activities culminating in an auto state. The auto state will lead to the new state if all the activities are completed.- Parameters:
sd- the state descriptor for the start state.testcaseList- the test case list that we need to generate.asd- - the Automatic state descriptor for the activities. This is a completion checker that leads to the new state.
-