[arquillian-issues] [JBoss JIRA] (ARQGRA-461) Running Graphene tests and use parallelStream method makes test fail with java.lang.IllegalStateException: The Graphene runtime isn't initialized. Exception.

Lukáš Fryč (JIRA) issues at jboss.org
Tue Sep 16 06:10:02 EDT 2014


    [ https://issues.jboss.org/browse/ARQGRA-461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13002737#comment-13002737 ] 

Lukáš Fryč commented on ARQGRA-461:
-----------------------------------

Hey Alex, this behavior is expectable as {{parallelStream()}} causes the collection to evaluate outside of parental thread.

You will end up with same issues for lot of Arquillian extensions.

----

In fact I think you won't get much gain with {{parallelStream()}} since the Selenium itself is likely serializing requests.

*Idea:* In order to speed up bulk operations, you can use JavaScript-based retrieval logic (JavaScript can return JSON of table structure that you can parse on server-side).

> Running Graphene tests and use parallelStream method makes test fail with java.lang.IllegalStateException: The Graphene runtime isn't initialized. Exception.
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ARQGRA-461
>                 URL: https://issues.jboss.org/browse/ARQGRA-461
>             Project: Arquillian Graphene
>          Issue Type: Bug
>            Reporter: Alex Soto
>            Priority: Minor
>              Labels: java8,, threads
>
> Running Graphene tests and use parallelStream method makes test fail with java.lang.IllegalStateException: The Graphene runtime isn't initialized. Exception.
> Basically the problem is when you want to get information about tables. You can iterate over elements in a foreach fashion, but you can also use new Java 8 stream API.
> This works: ession.findElements(xpath("//table/tbody/tr/td/span[@class='title']")).stream().map(WebElement::getText).collect(Collectors.toList());
> But if table is big you will try to improve parsing speed by adding parallelSteam (session.findElements(xpath("//table/tbody/tr/td/span[@class='title']")).parallelStream().map(WebElement::getText).collect(Collectors.toList());)
> And in this case an exception is thrown.
> Internally parallelStream uses a pool of threads so probably Graphene instance is tight to thread of test case, so the threads used by parallelStream does not contains a valid instance of Graphene.
> Of course this is not blocking nor a big problem in the sense that you can use stream() without any problem, and moreover Java 8 is not spread yet, but it may be a problem in the future.



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)



More information about the arquillian-issues mailing list