Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properties are not set as environment variables #1734

Closed
haroon-sheikh opened this issue Sep 1, 2020 · 4 comments · Fixed by #1773
Closed

Properties are not set as environment variables #1734

haroon-sheikh opened this issue Sep 1, 2020 · 4 comments · Fixed by #1773
Assignees

Comments

@haroon-sheikh
Copy link
Contributor

Describe the bug

When there's a large comment in the properties files, the properties after the comment are then skipped.

  1. Add this to a property file:
################################################################
#############################
################################################################
###############################################################
################################################################
##################################################################
##############################################################################
#####################################################
################################################################
##################################################################
################################################################
################################################################
####################################################################
################################################################
#########
#########################################################################
#################
#####################################
test_url=http://testurl
  1. Attempt to get test_url property. i.e. System.getenv("test_url")

Expected
3. The returned value should be http://testurl
Actual:
The returned value is "" (blank)

What command(s) did you run when you found the bug?

For e.g.

gauge run specs

Output, stack trace or logs related to the bug

Versions

Gauge (Output of gauge -v)

Gauge version: 1.1.1
Commit Hash: ea71913

Plugins
-------
flash (0.0.2)
html-report (4.0.12)
java (0.7.9)
json-report (0.3.3)
reportportal (1.7.0)
reportserver (0.2.0)
screenshot (0.0.1)
spectacle (0.1.4)
xml-report (0.2.3)

Node.js/Java/Python/.Net/Ruby version

Operating System information

IDE information

@haroon-sheikh
Copy link
Contributor Author

haroon-sheikh commented Sep 1, 2020

A sample project to reproduce the issue /~https://github.com/haroon-sheikh/gauge-issues/tree/gauge-1734

Run ./gradlew clean gauge

@BugDiver
Copy link
Member

BugDiver commented Sep 7, 2020

@haroon-sheikh When I ran the specified project, the env was not blank, It was set to localhost. The execution failed and here is the stacktrace.

# Property Specification
  ## Property Scenario        ✘
        Failed Step: verify property
        Specification: specs/Property.spec:4
        Error Message: org.junit.ComparisonFailure: expected:<http://[testurl]> but was:<http://[localhost:8080/]>
        Stacktrace:
        org.junit.Assert.assertEquals(Assert.java:115)
        org.junit.Assert.assertEquals(Assert.java:144)
        com.thoughtworks.gauge.example.pages.PropertySpec.verifyProperty(PropertySpec.java:10)
        java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        java.base/java.lang.reflect.Method.invoke(Method.java:566)
        com.thoughtworks.gauge.execution.MethodExecutor.execute(MethodExecutor.java:28)
        com.thoughtworks.gauge.execution.StepExecutionStage.executeStepMethod(StepExecutionStage.java:66)
        com.thoughtworks.gauge.execution.StepExecutionStage.executeStep(StepExecutionStage.java:59)
        com.thoughtworks.gauge.execution.StepExecutionStage.execute(StepExecutionStage.java:41)
        com.thoughtworks.gauge.execution.AbstractExecutionStage.executeNext(AbstractExecutionStage.java:14)
        com.thoughtworks.gauge.execution.HookExecutionStage.execute(HookExecutionStage.java:33)
        com.thoughtworks.gauge.execution.ExecutionPipeline.start(ExecutionPipeline.java:19)
        com.thoughtworks.gauge.processor.ExecuteStepProcessor.process(ExecuteStepProcessor.java:41)
        com.thoughtworks.gauge.RunnerServiceHandler.lambda$executeStep$7(RunnerServiceHandler.java:166)
        java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        java.base/java.lang.Thread.run(Thread.java:834)

@BugDiver
Copy link
Member

BugDiver commented Sep 7, 2020

I see that the property name in default is TEST_URL but in test it is test_url. Gauge properties are case sensitive, that's why you are getting default value.
Could you please make sure the property name is the same in all the files where you want to overwrite it, and then check if the issue exists?

@haroon-sheikh
Copy link
Contributor Author

@BugDiver I've updated the branch with the failing test haroon-sheikh/gauge-issues@46f1f28

Also if it helps, I've also added a unit test as part of this PR #1733

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants