背景:作为测试,开发写什么,测试自然就要测什么了,so = =

无scala基础,人较笨,折腾了两天才把环境弄好,如下:

一 IntelliJ Idea下载安装

这个真心是最简单的了

https://www.jetbrains.com/idea/ 选择需要的环境版本下载,一路安装即可

中间有一些插件的安装,可以此时选好也可以安装好idea后再进行安装。

为idea安装插件:

二 使用scalatest

1 在idea中新建项目

2 在build.sbt文件中增加行:

libraryDependencies += "org.scalatest" % "scalatest_2.11" % "3.0.1" % "test"

即可自动下载到本地,我的在“C:\Users\ThinkPad\.ivy2\cache\org.scalatest“

3 添加依赖

右键 External Libraies下的文件 -- > open Library Settings,打开设置窗口,添加scalatest和scalastatic。查看左侧已经添加成功

4 编写测试文件


package com.example
import org.scalatest.FlatSpec class HelloWorld extends FlatSpec{
def sayHello = "Hello" "Test A" should "Given is Equal with return" in {
assert("Hello" equals(sayHello))
}
"Test B" should "Given is not Equal with return" in{
assert("World" equals(sayHello))
} }

5 编译执行

① 在scala文件里右键 compile,然后再次右键 点击 Run ‘HelloWorld.Test ...’


② 此时会报错,是因为2.12里没有xml包,需要我们添加一下(我也不知道为什么)

与步骤四相同,找到xml包,添加即可,正确结果如下:

Test A执行成功;Test B执行失败

三 问题&总结

1 还没有开始正式使用scalatest做测试,遇到新问题了再记录

PS:这个版本问题简直比java还要糟糕。

IntelliJ Idea使用scalatest的更多相关文章

  1. [转] ScalaTest测试框架

    [From] https://blog.csdn.net/hany3000/article/details/51033610 ScalaTest测试框架 2016年04月01日 02:49:35 阅读 ...

  2. IntelliJ IDEA 2014 付费版 免费版比较

    http://www.jetbrains.com/idea/features/editions_comparison_matrix.html Freemarker, Velocity IDE Feat ...

  3. IntelliJ中的Scala入门

    IntelliJ IDE中的Scala入门 创建项目 打开IntelliJ并单击File => New => Project 在左侧面板中,选择Scala.在右侧面板中,选择IDEA. 将 ...

  4. Scala & IntelliJ IDEA:环境搭建、helloworld

      --------------------- 前言 --------------------- 项目关系,希望用Spark GraphX做数据分析及图像展示,但前提是得回spark:spark是基于 ...

  5. JetBrains IntelliJ IDEA 2019 for Mac(Java集成开发环境) 2019.3.1

    IntelliJ IDEA 2019中文激活版已全新上线,intellij idea mac是目前编程人员最喜欢的Java集成开发环境,具备智能代码助手.代码自动提示.重构.J2EE支持.Ant.JU ...

  6. [lean scala]|How to create a SBT project with Intellij IDEA

    this article show you how to create a SBT project with IDEA. prerequisite: 1.JDK8 2.Scala 2.11.8 3.I ...

  7. intellij idea 13&14 插件推荐及快速上手建议

    IntelliJIDEA插件安装 首页 > blog Tags : intellij IDEA插件安装 更新日期: 2015-04-29 IntelliJ IDEA插件下载地址: http:// ...

  8. 用IntelliJ IDEA创建Gradle项目简单入门

    Gradle和Maven一样,是Java用得最多的构建工具之一,在Maven之前,解决jar包引用的问题真是令人抓狂,有了Maven后日子就好过起来了,而现在又有了Gradle,Maven有的功能它都 ...

  9. [转载]从MyEclipse到IntelliJ IDEA-让你摆脱鼠标,全键盘操作

    从MyEclipse转战到IntelliJ IDEA的经历 注转载址:http://blog.csdn.net/luoweifu/article/details/13985835 我一个朋友写了一篇“ ...

随机推荐

  1. php 路径问题

    今天迁移网站服务器时,路径出错: 解决办法: 在网站首页根目录 设置define 全局变量 ——根目录: 在涉及目录的地方,统统替换为 根目录:

  2. 桶排序bucket sort

    桶排序 (Bucket sort)或所谓的箱排序的原理是将数组分到有限数量的桶子里,然后对每个桶子再分别排序(有可能再使用别的排序算法或是以递归方式继续使用桶排序进行排序),最后将各个桶中的数据有序的 ...

  3. 【剑指offer】连续子数组的最大和,C++实现

    原创博文,转载请注明出处!本题牛客网地址 博客文章索引地址 博客文章中代码的github地址 # 题目       输入一个整形数组,数组里有正数也有负数.数组中的一个或连续多个整数组成一个子数组.求 ...

  4. 个人博客网站 www.superzhang.site

    用django新建了一个博客网站,访问地址为www.superzhang.site.欢迎来逛逛.

  5. ajax完成团队信息异步添加【实际项目】

    第一:ajax往后台传参如何串(目前理解是json数组直接传给对象) 第二:ajax返回的数值通过PrintWriter.print方法返回 [参考前台页面关于团队信息是如何实现的] 参考页面user ...

  6. HDU2222 Keywords Search 【AC自动机】

    HDU2222 Keywords Search Problem Description In the modern time, Search engine came into the life of ...

  7. 1153 Decode Registration Card of PAT (25 分)

    A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, nam ...

  8. FirstTry_HelloWorld

    #include <qapplication.h> #include <qpushbutton.h> int main( int argc, char **argv ) { Q ...

  9. matlab rand, randn, randi

    rand 生成均匀分布的伪随机数.分布在(0~1)之间 randn 生成标准正态分布的伪随机数(均值为0,方差为1) randi 生成均匀分布的伪随机整数  

  10. Docker-Compose API too old for Windows

    I was working on some code with a Docker Windows container today and ran into this error message: ER ...