authorjapps/zerocode

Execute tests from a relative path of a scenario file from the PWD(Present Working Directory)

Open

#723 geöffnet am 11. Aug. 2025

Auf GitHub ansehen
 (8 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (447 Forks)auto 404
good first issue

Repository-Metriken

Stars
 (1.010 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Currently the Zerocode runner can execute a test from the Classpath. That's fine and we will retain this as this is given default to us. See example: https://github.com/authorjapps/zerocode/blob/master/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworld/JustHelloWorldTest.java

@TargetEnv("github_host.properties")
@RunWith(ZeroCodeUnitRunner.class)
public class JustHelloWorldTest {

    @Test
    @Scenario("helloworld/hello_world_status_ok_assertions.json") <---------- picks from Classapth
    public void testGet() throws Exception {
    }

}

AC1:

But, we need a mechanism to make it flexible to run even if

  • relative path is provided to the scenario file

Example 1:

    $pwd
    /home/authorj/code/zerocode
    $

    then, I should be able to run using below:
    @Test
    //  should pick from relative-apth from PWD //
    @Scenario("./http-testing-examples/src/test/resources/helloworld/hello_world_status_ok_assertions.json")
    public void testGet() throws Exception {
    }

   // in the above PWD =  /home/authorj/code/zerocode, which is represented by "."

Example 2:

    $pwd
    /home/authorj/code/zerocode/http-testing-examples/src
    $

    then, I should be able to run using below:
    @Test
    //  should pick from relative-apth from PWD //
    @Scenario("./test/resources/helloworld/hello_world_status_ok_assertions.json")
    public void testGet() throws Exception {
    }

   // in the above PWD =  /home/authorj/code/zerocode/http-testing-examples/src, which is represented by "."

Linked Issue #722

AC = Acceptance Criteria

Contributor Guide