Ok, I think I know what happened. It's nothing Geb 5 changed. I worked
with Leonard Brünings as he helped me clean up some bad code while figuring
out another issue. One the lines I cleaned up was an unused line in the
BaseTest: static Browser browse = new Browser()
With this line in place, even though it is unused anywhere, it seems as
thought the env variable set in GebConfig are evaluated in time. Without
this line, the GebConfig variables are not evaluated in time. I don't
fully understand it. I definitely want to have good code (I am aware
setting env variables in GebConfig is "bad", but it's working for us). So
if there is another way we can achieve these @IgnoreIf method getting
evaluated at the right time I am all for it. Any insights?
On Monday, March 28, 2022 at 1:47:48 PM UTC-5 jc wrote:
> I am currently in the process of trying to update our project's from 4.0
> to 5.1. Currently on 4.0, we have a BaseTest class that extends
> GebReportingSpec and then all other test classes extend BaseTest. In
> GebConfig.groovy, I have some lines that set different environment
> variables such as "runOnGrid" which is true/false, "browserType" which is a
> string, "env" which is the environment, etc....
>
> We have some @IgnoreIf statement in our code to prevent running on certain
> environments like Production. For example, we have an entire test class
> "TestClassA" that can run on pre-prod but we want to ignore the whole class
> for Prod. We put an @IgnoreIf annotation on the class that looks at
> `System.getProperty("env") == "prod"`
>
> This is currently working beautifully in 4.0. However in 5.1 this is no
> longer working as `System.getProperty("env")` is coming back as null
> along with all of the other variables we have set. These variables are set
> by the time we hit the setupSpec() in BaseTest, but they are null prior to
> that when they were not before. So it seems like before 5.0,
> GebConfig.groovy was getting run earlier is the compilation process
> perhaps? I guess I don't know how it all works, but I just know now that
> with Geb 5 this method is no longer working for us.
>
>
>
--
You received this message because you are subscribed to the Google Groups "Geb
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/geb-user/f66cd19f-fe4b-4411-817a-1c4f97d6dc24n%40googlegroups.com.