I create a Singleton class and run parallel testing using Maven.
I want the Singleton class to be instantiated only once. However, it is created every time when a test process starts.
I use the keyword "synchronized" in Singleton class but it only prevent
race condition within one test, not parallel tests.
Is it possible to create a cross process Singleton in Cucumber JVM? Thanks a lot for your help.
Here is the Singleton class definition:
Feature definition:
And two test files start at the same time, each test is as follows:
Here is the result, as you can see, the Singleton object is created twice, one for each test run:
I create a Singleton class and run parallel testing using Maven.
I want the Singleton class to be instantiated only once. However, it is created every time when a test process starts.
I use the keyword "synchronized" in Singleton class but it only prevent race condition within one test, not parallel tests.Is it possible to create a cross process Singleton in Cucumber JVM? Thanks a lot for your help.
Here is the Singleton class definition:
Feature definition:
And two test files start at the same time,
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Fri, May 2, 2014 at 3:06 AM, Ganggang Hu Guidice <ganggang...@gmail.com> wrote:
I create a Singleton class and run parallel testing using Maven.
I want the Singleton class to be instantiated only once. However, it is created every time when a test process starts.
I use the keyword "synchronized" in Singleton class but it only prevent race condition within one test, not parallel tests.Is it possible to create a cross process Singleton in Cucumber JVM? Thanks a lot for your help.
Here is the Singleton class definition:
Feature definition:
And two test files start at the same time,
How do you start two tests at the same time? If each test run is using a different JVM process, that is expected behaviour and it is not related to Cucumber.
--
David Kowis