It is possible to run a single, selected JUnit test method in IntelliJ IDEA 12, however this does not seem to be possible with ScalaTest. You can run the whole test class or nothing, but there seems to be no finer grained control for ScalaTest (yet) in IntelliJ IDEA 12. (I haven't tried IDEA 13 yet.)
So, the question: Is there a way to execute only a single, selected ScalaTest test method in IntelliJ (like it is possible with JUnit test methods.)
Below is a code sample whose test methods I'd like to run individually in IntelliJ. Any idea how to do that?
I've tried JUnitRunner but that did not help.
class NodeDAOTest extends FlatSpec with SessionAware with BeforeAndAfter {
before{ IM3_SessionFactory.removeData
println("before is running")}
println("NodeDAOTest constructor.")
def numberOfNodes=initAndCloseDB(transaction{NodeDAO.numberOfNodes})
"Node" can "be added to DB and removed." in {
val n =new TextNode
assert(numberOfNodes===0)
initAndCloseDB { transaction{session save n}}
assert(numberOfNodes===1)
initAndCloseDB { transaction{deleteNode(n)}}
assert(numberOfNodes===0)
}
def getTag= initAndCloseDB {transaction{ session.createQuery("from Tag").list().get(0).asInstanceOf[Tag]}}
def getNode=initAndCloseDB {transaction{ session.createQuery("from Node").list().get(0).asInstanceOf[Node]} }
it can "be tagged and untagged" in {
val t=new Tag
val n=new TextNode
assert(numberOfNodes==0,"before adding one tag (and Node), there should be 0 Node in the DB")
initAndCloseDB{ transaction {addTag(t,n) }}
assert (getNode.getNumberOfTags===1)
assert (getTag.getNodes.size===1)
initAndCloseDB(transaction{removeTag(t,n)})
assert (numberOfNodes==1,"after removing the tag, there should be 1 Node in the DB")
assert (getNode.getNumberOfTags===0)
assert (getTag.getNodes.size===0)
}
"Tagged Node" can "be removed." in {
val f=new TagAndNodeFixture
assert(numberOfNodes==1)
initAndCloseDB{ transaction {addTag(f.t,f.n) }}
initAndCloseDB { transaction{deleteNode (f.n)} }
assert(numberOfNodes==0)
// the tag will be removed from the node
}
"Tag" can "be deleted and that will be removed from in-memory Nodes" in{
}
}
"Setup for a day" should { "not go past the end of the day (1440 minutes)" in { val calendar = emptyCalendar calendar ! new Setup(DateTimeZone.UTC, Map(1 -> Seq(new Segment(2240, 1)))) assert(receiveOne(responseTime).isInstanceOf[Failure]) }
– Morality