zoukankan      html  css  js  c++  java
  • scala测试框架:scalatest

    api文档:http://tool.oschina.net/apidocs/apidoc?api=scalatest-1.7.2

    trait Assertions:http://tool.oschina.net/apidocs/apidoc?api=scalatest-1.7.2

    traitFunSuite:http://tool.oschina.net/apidocs/apidoc?api=scalatest-1.7.2

    请看代码片段一和二的区别:这里有很多规定写法。

    代码片段一:是一个测试套,根据名字SetSuite识别。在IDEA中执行的时候,你可以选择执行整个测试套(包含2个用例),或者执行执行测试套的某个用例

    package org.scalatest.examples.funsuite
    
    import org.scalatest.FunSuite
    
    class SetSuite extends FunSuite {
    
      test("An empty Set should have size 0") {
        assert(Set.empty.size === 0)
      }
    
      test("Invoking head on an empty Set should produce NoSuchElementException") {
        intercept[NoSuchElementException] {
          Set.empty.head
        }
      }
    }

     代码片段二:是一个测试用例,根据名字SetTest识别。在IDEA执行的时候,只会执行一个测试用例setTest,测试用例的名字是固定写法

    package org.scalatest.examples.funsuite
    
    import org.scalatest.FunSuite
    
    class SetTest extends FunSuite {
    
      test("setTest") {
        assert(Set.empty.size === 0)
      }
    
      test("setTest1") {
        intercept[NoSuchElementException] {
          Set.empty.head
        }
      }
    }

    参考:

    http://orchome.com/246

    http://www.scalatest.org/quick_start

    https://www.jianshu.com/p/ceabf3437dd7

  • 相关阅读:
    统计脚本代码行数
    expr算术运算
    lsof命令
    测试当前机器可以创建多少线程
    守护进程写日志
    文件描述符fd,struct files_struct
    linux查看反汇编
    信号补充
    Windows10获取VS管理员权限总是很烦人
    asp.net中的Filter类型其实是被当作单例的
  • 原文地址:https://www.cnblogs.com/shengulong/p/9329373.html
Copyright © 2011-2022 走看看