Skip to content

Comments

Support @ParameterizedTest and @RepeatedTest in runnables#200

Open
tartarughina wants to merge 2 commits intozed-extensions:mainfrom
tartarughina:test-runner
Open

Support @ParameterizedTest and @RepeatedTest in runnables#200
tartarughina wants to merge 2 commits intozed-extensions:mainfrom
tartarughina:test-runner

Conversation

@tartarughina
Copy link
Collaborator

Address #198

@tartarughina
Copy link
Collaborator Author

Tested with

package com.example.runnables;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

// Matches: java-test-class, java-test-method (via @Test)
// Matches: java-test-method (via @ParameterizedTest)
// Matches: java-test-method (via @RepeatedTest)
class RunnablesTest {

    @Test
    void standardTest() {
    }

    @ParameterizedTest
    @ValueSource(strings = {"a", "b"})
    void parameterizedTest(String value) {
        System.out.println("Test value: " + value);
    }

    @RepeatedTest(3)
    void repeatedTest() {
    }

    // Matches: java-test-class-nested, java-test-method-nested
    @Nested
    class NestedWithTest {

        @Test
        void nestedStandardTest() {
        }
    }

    @Nested
    class NestedWithParameterizedTest {

        @ParameterizedTest
        @ValueSource(ints = {1, 2})
        void nestedParameterizedTest(int value) {
        }
    }

    @Nested
    class NestedWithRepeatedTest {

        @RepeatedTest(2)
        void nestedRepeatedTest() {
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants