prashant-ramcharan / courgette-jvm

Multiprocess | Parallel Cucumber-JVM | Parallelize your Java Cucumber tests on a feature level or on a scenario level.
MIT License
130 stars 38 forks source link

Query : How to retrieve System and environment info details #401

Closed MadhuQAAutomation closed 3 months ago

MadhuQAAutomation commented 3 months ago

Hi Prashant - Is there a way to access the system and environment variables that are displayed in courgette html report through 'CourgetteTestStatistics' or 'CourgetteRunInfo' from the Courgette runner class.?

prashant-ramcharan commented 3 months ago

Hello, which data from the Courgette html report do you need to access from the Courgette runner?

You won't be able to access Courgette generated system properties via your Courgette runner because these properties are only generated during the test. However you should be able to access these properties in the tests.

MadhuQAAutomation commented 3 months ago

Hello Prashant - I would need to retrieve the fields in the Run Information and Environment Information sections.

prashant-ramcharan commented 3 months ago

The fields in the run information are basically the same information you already have in your Courgette runner.

If you passing system properties or setting environment variables before the tests run then you will already have access to this using System.getProperties() and System.getenv() in the Courgette runner.

prashant-ramcharan commented 3 months ago

You should have access to the data using CourgetteRunInfo class in your runner.

        @CourgetteBeforeAll
        public static void beforeRun() {
                System.out.println("Session: " + CourgetteRunInfo.sessionId());
                System.out.println("Environment info: " + CourgetteRunInfo.courgetteOptions().environmentInfo());
                System.out.println("Cucumber tags: " + Arrays.toString(CourgetteRunInfo.courgetteOptions().cucumberOptions().tags()));
        }
MadhuQAAutomation commented 3 months ago

Thanks!. I will try this..