[
https://issues.jboss.org/browse/ARQGRA-461?page=com.atlassian.jira.plugin...
]
Lukáš Fryč resolved ARQGRA-461.
-------------------------------
Assignee: Lukáš Fryč
Resolution: Rejected
Agree, {{parallelStream()}} is in Selenium / Graphene 2.x a misuse that is expected to
lead into threading issues.
If there would be really an elevated need, we may re-consider allowing such a usage by
propagating contexts.
Thanks for describing the issue though, Alex, at least for future reference, as you say!
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
Assignee: Lukáš Fryč
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)