Friday Jul 25, 2008

Scala for NetBeans Screenshot#12: JUnit integration

There is a Scala JUnit Test template in Scala for NetBeans now, you can create Scala JUnit testing and run testing, see testing result.

Here is an example test file:

 /*
 * DogTest.scala
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package scalajunit

import org.junit.After
import org.junit.Before
import org.junit.Test
import org.junit.Assert._

class DogTest {

    @Before
    def setUp() = {
    }

    @After
    def tearDown() = {
    }

    @Test
    def testHello() = {
        val dog = new Dog()
        dog.talk("Mr. Foo")
        assert(true)
    }

    @Test
    def testAdding() = {
        assertEquals(4, 2 + 3)
    }
}

To get JUnit working, upgrade to Scala Project Module version 1.2.14, and re-create a new project for exist old project (if there has been one). Under the "Test Packages", create your testing packages, right click on package node, select create "Scala JUnit Test".

To run tests, right-click on project node, choose "Test".

And also, the beta-release is feature frozen, I'll concentrate on bug-fixes in next 1-2 weeks, and get it ready for public release as beta.

nn

Comments:

Post a Comment:
Comments are closed for this entry.