You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Mark Baran <me...@gmail.com> on 2008/06/09 22:08:41 UTC

ScalaCheck

I'd like to use buildr with ScalaCheck, for a Scala program I'm  
currently writing.  How would I do this?

The scalacheck files are currently in src/test/scala and they compile  
just fine.

Thanks,
Mark

Re: ScalaCheck

Posted by Mark <me...@gmail.com>.
Alex Boisvert wrote:
> On Sun, Jun 15, 2008 at 1:53 AM, Mark Baran <me...@gmail.com> wrote:
>
>   
>> I finished porting my tests to scalatest, which took far less time than I'd
>> suspected.
>>
>> However, how do I instruct Buildr to run these Scalatests?  What do I put
>> in
>> my buildfile?
>>     
>
>
> Buildr should pick up the tests automatically if they are under
> "src/test/scala" and if your test classes extend org.scalatest.Suite, so you
> don't have to put anything in your Buildfile if you follow these
> conventions.
>
> To run your tests, you would simply type:  "buildr test"
>
>   
I'm extending PropSuite, but buildr test doesn't seem to be running any 
of the tests.  Any ideas what I'm doing wrong?  I'm attaching the test 
scala file, which itself is being compiled flawlessly, without any 
errors.  This file should just automagically run when I execute buildr 
test right?
> On an unrelated note, I'm getting some weird errors in Buildr:  when I
>   
>> download dependencies that I add, the console complains:
>>
>> stty: standard input Invalid argument => dependency seems to download
>> normally => stat.st_gid unsupported on this platform
>>
>> Rake aborts and I'm left high and dry.  However, if I run buildr a couple
>> times, enough to download every dependency, it finally works.  I'm on AMD64
>> linux running Buildr on Jruby with Java 1.6.
>>     
>
>
> I'm guessing the error above is due to JRuby.   Can you file a bug?
>
> alex
>
>   
I'm filing the bug right now, and will probably test against the jruby 
trunk just to pinpoint it down.

Thanks for your help!
Mark

Re: ScalaCheck

Posted by Alex Boisvert <bo...@intalio.com>.
On Sun, Jun 15, 2008 at 1:53 AM, Mark Baran <me...@gmail.com> wrote:

> I finished porting my tests to scalatest, which took far less time than I'd
> suspected.
>
> However, how do I instruct Buildr to run these Scalatests?  What do I put
> in
> my buildfile?


Buildr should pick up the tests automatically if they are under
"src/test/scala" and if your test classes extend org.scalatest.Suite, so you
don't have to put anything in your Buildfile if you follow these
conventions.

To run your tests, you would simply type:  "buildr test"

On an unrelated note, I'm getting some weird errors in Buildr:  when I
> download dependencies that I add, the console complains:
>
> stty: standard input Invalid argument => dependency seems to download
> normally => stat.st_gid unsupported on this platform
>
> Rake aborts and I'm left high and dry.  However, if I run buildr a couple
> times, enough to download every dependency, it finally works.  I'm on AMD64
> linux running Buildr on Jruby with Java 1.6.


I'm guessing the error above is due to JRuby.   Can you file a bug?

alex

Re: ScalaCheck

Posted by Mark Baran <me...@gmail.com>.
I finished porting my tests to scalatest, which took far less time than I'd
suspected.

However, how do I instruct Buildr to run these Scalatests?  What do I put in
my buildfile?

On an unrelated note, I'm getting some weird errors in Buildr:  when I
download dependencies that I add, the console complains:

stty: standard input Invalid argument => dependency seems to download
normally => stat.st_gid unsupported on this platform

Rake aborts and I'm left high and dry.  However, if I run buildr a couple
times, enough to download every dependency, it finally works.  I'm on AMD64
linux running Buildr on Jruby with Java 1.6.

Help with either of these two concerns is much obliged,
Mark

On Tue, Jun 10, 2008 at 8:09 AM, Alex Boisvert <bo...@intalio.com> wrote:

> 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 <me...@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 <me...@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
> >>
> >
> >
>

Re: ScalaCheck

Posted by Alex Boisvert <bo...@intalio.com>.
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 <me...@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 <me...@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
>>
>
>

Re: ScalaCheck

Posted by Mark Baran <me...@gmail.com>.
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 <me...@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


Re: ScalaCheck

Posted by Alex Boisvert <bo...@intalio.com>.
On Mon, Jun 9, 2008 at 1:08 PM, Mark Baran <me...@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