how to use forAll in scalatest to generate only one object of a generator?
<p>Im working with scalatest and scalacheck, alsso working with FeatureSpec.</p>

<p>I have a generator class that generate object for me that looks something like this:</p>

<pre><code>object InvoiceGen {

  def myObj = for {

    country &lt;- Gen.oneOf(Seq("France", "Germany", "United Kingdom", "Austria"))
    type &lt;- Gen.oneOf(Seq("Communication", "Restaurants", "Parking"))
    amount &lt;- Gen.choose(100, 4999)
    number &lt;- Gen.choose(1, 10000)
    valid &lt;- Arbitrary.arbitrary[Boolean]

  } yield SomeObject(country, type, "1/1/2014", amount,number.toString, 35, "something", documentTypeValid, valid, "")
</code></pre>

<p>Now, I have the testing class which works with FeatureSpec and everything that I need to run the tests.</p>

<p>In this class I have scenarios, and in each scenario I want to generate a different object.
The thing is from what I understand is that to generate object is better to use forAll func, but for all will not sure to bring you an object so you can add minSuccessful(1) to make sure you get at list 1 obj....</p>

<p>I did it like this and it works:</p>

<pre><code>scenario("some scenario") {
      forAll(MyGen.myObj, minSuccessful(1)) { someObject =&gt;
        Given("A connection to the system")
        loginActions shouldBe 'Connected

        When("something")
        //blabla
        Then("something should happened")
        //blabla
      }
    }
</code></pre>

<p>but im not sure exactly what it means.
What I want is to generate an invoice each scenario and do some actions on it...
im not sure why i care if the generation work or didnt work...i just want a generated object to work with.</p>