This post originated from an RSS feed registered with Scala Buzz
by Caoyuan Deng.
Original Post: Scala for NetBeans Screenshot#12: JUnit integration
Feed Title: Blogs about Scala from Caoyuan
Feed URL: http://blogtrader.org/page/dcaoyuan/feed/entries/atom?tags=scala
Feed Description: Blogs about Scala from Caoyuan Deng
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(): Unit = {
}
@After
def tearDown(): Unit = {
}
@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.