testproject-io / java-opensdk

TestProject Java OpenSDK
Apache License 2.0
50 stars 42 forks source link

Multiple jobs are reported ehen running several tests that infer project/job name #110

Closed s-glatshtein closed 3 years ago

s-glatshtein commented 3 years ago

When running the class in the following example, 2 job reports will be created with one test in each, rather than 1 job report with 2 tests:

import io.testproject.sdk.drivers.web.ChromeDriver;
import io.testproject.sdk.internal.exceptions.AgentConnectException;
import io.testproject.sdk.internal.exceptions.InvalidTokenException;
import io.testproject.sdk.internal.exceptions.ObsoleteVersionException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
import org.openqa.selenium.chrome.ChromeOptions;

import java.io.IOException;
import java.net.URL;

@EnabledIfEnvironmentVariable(named = "TP_DEV_TOKEN", matches = ".*?")
public final class JUnitTests {
    @Test
    public void test1() throws IOException, InvalidTokenException, AgentConnectException, ObsoleteVersionException {
        ChromeDriver driver = new ChromeDriver(new URL("http://localhost:9999"), new ChromeOptions());
        driver.navigate().to("https://example.testproject.io/web/");
        driver.quit();
    }

    @Test
    public void test2() throws IOException, InvalidTokenException, AgentConnectException, ObsoleteVersionException {
        ChromeDriver driver = new ChromeDriver(new URL("http://localhost:9999"), new ChromeOptions());
        driver.navigate().to("https://example.testproject.io/web/");
        driver.quit();
    }
}