[JBoss JIRA] (ARQGRA-382) Make @InitialPage work for Field
by Vsevolod Golovanov (JIRA)
[ https://issues.jboss.org/browse/ARQGRA-382?page=com.atlassian.jira.plugin... ]
Vsevolod Golovanov edited comment on ARQGRA-382 at 8/4/17 11:20 AM:
--------------------------------------------------------------------
bq. However, all other fields in tests preserve the state among tests, so Before would be an exception.
That seems worrisome, does this imply that the page instances behind \@Page fields survive between test methods? JUnit creates a new test class instance for each of the \@Test methods - each of those runs is supposed to be a self-contained independent execution unaffected by other runs. One method execution seems to be a proper natural scope for \@InitialPage too. -It also mirrors the default Drone instance scope- (Update: I forgot, the default is class scope.) (but I don't think these scopes should always be equated, though class scoped InitialPage certainly makes no sense with a method scoped Drone).
Maybe {{\@InitialPage static_field}} = BeforeClass, {{\@InitialPage instance_field}} = Before? Gotta not break parallel execution though...
was (Author: vsevolodgolovanov):
bq. However, all other fields in tests preserve the state among tests, so Before would be an exception.
That seems worrisome, does this imply that the page instances behind \@Page fields survive between test methods? JUnit creates a new test class instance for each of the \@Test methods - each of those runs is supposed to be a self-contained independent execution unaffected by other runs. One method execution seems to be a proper natural scope for \@InitialPage too. It also mirrors the default Drone instance scope (but I don't think these scopes should always be equated, though class scoped InitialPage certainly makes no sense with a method scoped Drone).
Maybe {{\@InitialPage static_field}} = BeforeClass, {{\@InitialPage instance_field}} = Before? Gotta not break parallel execution though...
> Make @InitialPage work for Field
> --------------------------------
>
> Key: ARQGRA-382
> URL: https://issues.jboss.org/browse/ARQGRA-382
> Project: Arquillian Graphene
> Issue Type: Enhancement
> Components: core
> Affects Versions: 2.0.0.CR1
> Reporter: Karel Piwko
> Fix For: 2.0-Tracking
>
>
> While @InitialPage allows to be used on test class field, it does not do anything.
> {code}
> @InitialPage AddUserPage page;
> @Test
> void test() {
> page.foo()
> }
> {code}
> raises
> {code}
> java.lang.NullPointerException: null
> at com.acme.example.test.DroneTest.addUser(DroneTest.java:35)
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)