buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Boisvert" <boisv...@intalio.com>
Subject Re: ScalaCheck
Date Tue, 10 Jun 2008 15:09:03 GMT
You can refer to ScalaTest's website (http://www.artima.com/scalatest/) for
some examples on how to use ScalaCheck from within ScalaTest.

I just tried this one that uses ScalaCheck properties:

import org.scalatest.prop.PropSuite
import org.scalacheck.Arbitrary._
import org.scalacheck.Prop._

class MySuite extends PropSuite {

  test("list concatenation") {
    val x = List(1, 2, 3)
    val y = List(4, 5, 6)
    assert(x ::: y === List(1, 2, 3, 4, 5, 6))
    check((a: List[Int], b: List[Int]) => a.size + b.size == (a ::: b).size)
  }

  test(
    "list concatenation using a test method",
    (a: List[Int], b: List[Int]) => a.size + b.size == (a ::: b).size
  )
}

alex


On Mon, Jun 9, 2008 at 9:14 PM, Mark Baran <mebaran@gmail.com> wrote:

> What do you mean by implement org.scalatest.Sute?  Is this something I
> extend?  If you link me to some good doc, I'm more than happily bug test.
>
> I don't know much about ScalaTest, but if you tell me how to set it up I'll
> do the rest!
>
> Mark
>
>
> On Jun 10, 2008, at 12:03 AM, Alex Boisvert wrote:
>
>  On Mon, Jun 9, 2008 at 1:08 PM, Mark Baran <mebaran@gmail.com> wrote:
>>
>>  I'd like to use buildr with ScalaCheck, for a Scala program I'm currently
>>> writing.  How would I do this?
>>>
>>
>>
>> Hi Mark,
>>
>> Thanks for opening the door for me :)
>>
>> I just committed support for ScalaTest, ScalaCheck and Specs test
>> frameworks
>> on the Buildr trunk.   We have good tests for ScalaTest right now.  I've
>> manually tested Specs but still need to write automated tests for it.   I
>> haven't tested ScalaCheck support at all yet, but you're welcome to give
>> it
>> a try.   At this time it's assumed that you use ScalaCheck through
>> ScalaTest
>> or Specs.    ScalaCheck tests must implement "org.scalatest.Suite" whereas
>> Specs tests must reside in a class with a name ending with "Spec" or
>> "Specs".  The test framework should kick in automatically by the presence
>> of
>> any .scala file under src/test/scala.
>>
>> There's a few additional things left to do such as logging Specs output to
>> file and better detection of Specs test but the basics should work.   I'll
>> be adding documentation soon too.
>>
>> Give it a go and let me know if you find anything irregular.
>>
>> cheers,
>> alex
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message