Scala使用JUnit4单元测试


在项目开发中在很多地方都要做单元测试,在做Spark项目时使用Scala开发.所以总结一下Scala中的单元测试:

在Maven pom文件中添加依赖:

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.11</version>
  <scope>test</scope>
</dependency>
import org.junit.{Assert, Test} @Test class CrawlTest extends Assert{ @Test def hel:Unit = { val someValue = true assert(someValue == true) } }

运行:

使用Intelij IDEA,把光标点击在方法名那一行上,右键,run。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM