mercredi 11 novembre 2020

How to use Table tests on scala?

I'm trying to write a test with "N test cases" instead of a single test for every test case, I've found on google the Table class but when I try to add them to my test the class Table does not work, it keeps giving me the error:

Cannot resolve overloaded method 'Table'

The test:

import org.scalatest.prop.TableDrivenPropertyChecks

class PublishEventServiceSpec extends AsyncWordSpec
    with FixtureSupport
    with Matchers
    with AsyncMockFactory
    with TableDrivenPropertyChecks {


"#my test cases" should {
    "test cases" in {
        val cases = Table(1, 2)
        forAll (cases) { c => assert(c != 0) }
    }
}

The method forAll also gives me the same error "Cannot resolve overloaded method 'forAll'", how can I use the Table and forAll on my tests?

scalatest version: 3.0.8

scala version: 2.11.*

Aucun commentaire:

Enregistrer un commentaire