sbt test prompt
no tests are executed.How to solve it ?
I’ve recently tried to write a collection that solves LeetCode with Scala. ScalaTest is generally recommended for unit testing in Scala, and most Scala users have a Java background , so ScalaTest can also be integrated with JUnit, see link for a further understanding
What Is The Problem?
At first writing test code like this ：
build.sbt is as follows：
Above is the most standard code for
There is no problem in running test cases with Intellij IDEA and
sbt test at the same time.
If you want to import Junit,then it will be：
Currently we can use Intellij IDEA to run unit tests, but if you use
sbt test to run it in console, it will hint
no tests are executed. If you want to have a continuous development,then manybe you know some famous tools such as TravisCI which cooperates well with github.I write a
.travis.yml file.Now ScalaTest and JUnit can’t work on Linux Platform.
Based on this question run-junit-tests-with-sbt you need to add the following code on original
The reason for this problem is that Scala and Java finally compiled two different sets of bytecodes. Although in most cases it is compatible,but you also need to mind the corner case.
BTW,Looked at it, the test cases in Spark are all using the pure ScalaTest framework, without using JUnit.
Exercises for 《Scala For Impatient》 and some notes for Scala 99
Scala’s syntax is as complex as C++…
The author of 《Scala CookBook》 evaluates the nature of Java’s syntax as
Verbose yet obvious. It is because of the obvious characteristics that it can lead in the industrial development,play a dominant role in
Web development/Android/big data field. It is also because of the verbose characteristics and boilerplate code that people can feel really tired when writing in Java,especailly compared with Python.
Scala based on the JVM platform is a nice improvement of Java. Scala’s official website promotes OO meets FP, which combines the benefits of object-oriented and functional programming. As many people have said, there is no need to fully understand Scala’s grammar and use it later.
Scala is mainly divided into two aspects when learning:
A series of Immutable and Mutable objects such as Array/List/Seq , corresponding to take/filter/map/flatMap/reduce/head/tail/init method, etc.
new OO related content such as class/case class/object/trait
A3/L2 level will meet the daily needs.
Recently I have done some of the problems in Scala99, trying to do some excerpts, some of which have different methods from the original ones.
- Question 17:
** Requirements**: Divide a List into two parts
directly return (ls.take(n), ls.drop(n))methods are available on the website
My own implementation:
And I implement a small demo about class and traits: