jpath
can return null
Hi all. I'm trying to write a set of tests that are not run by default but can be run when desired. I've created a custom config (and looked at everything I can find on this problem on Google) that allows me to select or disselect tests with the tag IELE
but I'm still running into an issue. This is my SBT project definition:
val node = {
val node = project
.in(file("node/instance"))
.dependsOn(
...
)
.settings(commonSettings("node"): _*)
.settings(
libraryDependencies ++= ...
)
.settings(
buildInfoKeys := BuildInfoKey.ofN(
name,
version,
scalaVersion,
sbtVersion,
gitHeadCommit,
gitCurrentBranch,
gitCurrentTags,
gitDescribedVersion,
gitUncommittedChanges,
libraryDependencies in Compile
),
buildInfoPackage := "...",
buildInfoObject := "NodeBuildInfo",
buildInfoOptions in Compile += BuildInfoOption.ToMap
)
.settings(
(soliditySources in Compile) ++= Seq(
baseDirectory.value / "src" / "evmTest" / "resources" / "solidity",
baseDirectory.value / "src" / "test" / "resources" / "solidity",
baseDirectory.value / "src" / "precompiledContracts" / "resources" / "solidity"
)
)
.settings(
executableScriptName := name.value,
mainClass in Compile := Some("io.iohk.ethereum.App"),
discoveredMainClasses in Compile := Seq(),
// Requires the 'ant-javafx.jar' that comes with Oracle JDK
// Enables creating an executable with the configuration files, has to be run on the OS corresponding to the desired version
jdkPackagerType := "image",
mappings in Universal += (resourceDirectory in Compile).value / "blockchain" / "development-genesis.json" -> "conf/development-genesis.json",
mappings in Universal += (resourceDirectory in Compile).value / "logback.xml" -> "conf/logback.xml"
)
val Integration = config("it") extend Test
scalastyleSources in Test ++= { (unmanagedSourceDirectories in Integration).value }
val Benchmarks = config("benchmarks") extend Test
val EvmTest = config("evmTest") extend Test
val PrecompiledContracts = config("precompiledContracts") extend Test
coverageExcludedPackages := "io\\.iohk\\.ethereum\\.extvm\\.msg.*"
Test / testOptions += Tests.Argument("-l", "iele")
val Iele = config("iele") extend Test
Iele / testOptions -= Tests.Argument("-l", "iele")
Iele / testOptions += Tests.Argument("-n", "iele")
node
.configs(Integration, Benchmarks, EvmTest, PrecompiledContracts, Iele)
.settings(
inConfig(Integration)(
Defaults.testSettings ++ BloopDefaults.configSettings ++ Seq(parallelExecution in Test := false)
): _*
)
.settings(inConfig(Benchmarks)(Defaults.testSettings ++ BloopDefaults.configSettings): _*)
.settings(inConfig(EvmTest)(Defaults.testSettings ++ BloopDefaults.configSettings): _*)
.settings(inConfig(PrecompiledContracts)(Defaults.testSettings ++ BloopDefaults.configSettings): _*)
.settings(inConfig(Iele)(Defaults.testSettings ++ BloopDefaults.configSettings): _*)
When I run iele:test
in SBT console it returns immediately saying no tests were run. Any ideas?
def dummy(): Any = true
it should "test Any as bool" in {
dummy() should be (true) // <- doesn't work
dummy() should be (true.asInstanceOf[Any]) // <- works fine
}
def dummy(): Any = true
it should "test Any as bool" in {
dummy() should be (true) // <- doesn't compile
dummy() should be (true.asInstanceOf[Any]) // <- works fine
dummy() should be (1) // <- compiles fine, fails as expected
}
Hey I just migrated from scalatest 3.2.0 to 3.2.1 and I see a weird behaviour in the output.
In the 3.2.0, I see in the stdout my suite tests something like :
MyTests
Test1Spec
- test1
- test2
...
All tests passed
While in 3.2.1, I have some tests that do no passed but I only get :
info] *** 24 TESTS FAILED ***
[error] Failed tests:
[error] FunctionalTestSpec
[error] (functional-test / Test / test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 87 s (01:27), completed 20 déc. 2021, 14:08:05
I don't see now which tests are not passing which is a bit hard to debug :-D
I've checked the releases notes and I don't have the feeling to miss something but maybe you can help me ?
abstract class Test extends Suite with FunSuiteLike with Matchers {}
abstract class Context {}
abstract class TestTest[CONTEXT <: Context] extends Test with TimeLimitedTests {
}
override def timeLimit: Span = Span.Max
checkstyle
to ensure that each test (it
in FunAnySpec
) has at least one assertion? In a group of suites of ~10K tests, I have already found in some cases a test without any assertion, so I'd like to know if I could have a way to check that.pendingUntilFixed
throws NotImplementedError
. This causes the test to be marked as failed. When I change it to UnsupportedOperationException
, it works fine. Is this expected? If it is, what is the rationale? NotImplementedError
is commonly used for unfinished code, for which pendingUntilFixed
looks like a perfect solution.
Prettifier.truncateAt
work for collections within case classes