Work with branch branches

I need to test a multi-step (about 70-90 steps) process that has some specific exit conditions at each step. I have a test for the path of a happy event (everything succeeds), and I would like to use it as a basis for modeling the paths of a not-so-happy case (i.e., for every possible exit condition, I need a test case, which is a small variation of the path happy occasion).

I thought about using a variation on the template template (i.e., simulating a generic test case driver as a template and based on each individual test), but it quickly became rather cumbersome.

Since these are purely systemic systems (communication protocol), I can simulate tests as event streams, but this does not help me organize specific test cases as changes in the general sequence.

+4
source share
2 answers

The case you asked in this question is very similar to a good candidate for a data-driven testing strategy. " Gerard Mesaros " xUnit Test Patterns: Test Code Refactoring, defines the conditions for testing in order to qualify for a data-based testing strategy, as follows (p 288):

, , . .

:

, ( "", , , , , ..) () " ". . , script, .

, , , . . , . / DSL (Domain-Specific-Language) ( xUnit Test Patterns p288). , , , .



:

+3

, junit-nested, setup() teardown() :

@RunWith(Nested.class)
public class NestedJunitTest {

    @Test public void testWithoutLogin() { // expect 401

    public class LoggedInTests {

        Session session;

        @Before public void login() { session = new Session(..)

        @Test public void testLoggedIn() { ...

.

+3

Source: https://habr.com/ru/post/1529552/


All Articles