[
https://issues.jboss.org/browse/ARQGRA-461?page=com.atlassian.jira.plugin...
]
Alex Soto updated ARQGRA-461:
-----------------------------
Description:
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.
Steps to Reproduce: Create a Graphene Page object which uses a WebElement inside a
parallelStream.
Labels: java8, threads (was: )
Workaround Description: Although you cannot use parallelStream() you can use stream()
method.
Workaround: Workaround Exists
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)