"No tests to run" from command-line and "Empty suite" from IntelliJ 12.1.3.
Closed this issue · 3 comments
janm399 commented
When writing a Specs2 Spring test in IJ 12.1, using just the ContextConfiguration
annotation on a class that extends Specification
, IJ complains that there is "Empty Suite".
import com.myApp.domain.entities.user.User
import com.myApp.domain.entities.EntityId
import com.myApp.domain.repositories.user.UserRepository
import org.specs2.spring.Specification
import org.springframework.test.context.ContextConfiguration
import org.springframework.beans.factory.annotation.Autowired
@ContextConfiguration(Array("classpath*:/application-context-test.xml"))
class UserRepositoryImplSpec extends Specification {
@Autowired
var userRepository: UserRepository = _
"Features are" in {
"A new user should be persistable into Neo4j " ! {
newUserShouldBePersistedIntoNeo4j
}
}
def newUserShouldBePersistedIntoNeo4j = {
val user: User = User("userName", "password", "test", "test", "test@gmail.com").toOption.get
userRepository.save(user) must not(throwAn[Throwable])
}
}
mica16 commented
Here's a more succinct sample that reproduces the "bug" of "EmptyTest":
import org.specs2.spring.Specification
class Specs2SpringTest extends Specification {
"This test doesn't want to run" should {
"Show you other thing that '0 example, 0 failure, 0 error' in SBT console or 'Empty test suite' in IntelliJ" in {
success
}
}
}
Output From IntelliJ:
Testing started at 20:34 ...
Empty test suite.
However this works:
import org.specs2.mutable.Specification //replaced by original mutable version
class Specs2SpringTest extends Specification {
"This test doesn't want to run" should {
"Show you other thing that '0 example, 0 failure, 0 error'' in SBT console or 'Empty test suite' in IntelliJ" in {
success
}
}
}
Testing started at 20:43 ...
This test doesn't want to run should
Please show me something green
Process finished with exit code 0
janm399 commented
The latest snapshot, 1.0.1-SNAPSHOT
, now at Sonatype Snapshots, successfully runs the test in EmptySuiteSpec.scala
mica16 commented
Great :) Thank you !