简体   繁体   中英

How to make IntelliJ Scala plugin run the unit test, or how to teach IntelliJ that a file is a unit test code?

In IntelliJ/Scala plugin, how can I run the Scala test code?

class TestFile extends FunSuite with BeforeAndAfter {
  test ("simple") {

I'm not sure exactly what happened, but I remember IntelliJ/Scala plugin automatically showed me a "run" menu with the right click, but I see nothing about the run menu. Is there any setup change to teach this file is Scala test file that can be executed?

在此处输入图片说明

Find the directory where all your tests are (if you are using Maven directory structure that would be src/test/scala) right click on it and choose "Mark directory as"-> "Test Sources Root". This would tell IntelliJ that the directory contains test and would make it offer to run tests in the right click menu of files

Right click on the source (especially on test class name or test name) opens up a menu that shows the run menu.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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