首页 > 解决方案 > run scala test from Intellij

问题描述

Below is the main class :

object HelloWorld {
  def hello() = "Hello "
}

Below is test suite:

import org.scalatest.{Matchers, FunSuite}

class HelloWorldTest extends FunSuite with Matchers {

  test("Say Hi!") {
    HelloWorld.hello() should be ("Hello, World!")
  }
}

I wanted to run the test cases from Intellij. I tried configuration type ScalaTest and Application and the configuration package does not appear to select.

How to run the test cases from Intellij

标签: scalaintellij-idea

解决方案


不确定我是否正确,但您可以通过多种方式做到这一点:

  1. 右键单击 HelloWorldTest 并选择运行
  2. 右键单击项目文件树上的文件名,然后单击运行
  3. 您可以在工具栏中选择运行 => 编辑配置 => + 在左侧 => ScalaTest => 给它一个名称并在“测试类:”中编写 HelloWorldTest => 好的,然后再次运行并运行并选择您提供的名称它

推荐阅读