简体   繁体   English

从Intellij运行scala测试

[英]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. 我想从Intellij运行测试用例。 I tried configuration type ScalaTest and Application and the configuration package does not appear to select. 我尝试了配置类型ScalaTest和应用程序,但似乎没有选择配置包。

How to run the test cases from Intellij 如何从Intellij运行测试用例

Not sure if I got you right but you can do it in multiple ways: 不知道我是否正确,但是您可以通过多种方式做到这一点:

  1. Right click on HelloWorldTest and choose Run 右键单击HelloWorldTest并选择运行
  2. Right click on the file name on the project file tree and click Run 右键单击项目文件树上的文件名,然后单击“运行”。
  3. You can select Run in toolbar => Edit Configurations => + on left up side => ScalaTest => give it a name and write HelloWorldTest in "Test class:" => Ok and then Run and run again and choose the name you gave it 您可以选择在工具栏上运行=>编辑配置=> +左上侧=> ScalaTest =>给它起个名字,然后在“测试类:”中输入HelloWorldTest =>确定,然后再次运行并选择您给定的名字它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM