Skip to content

Text Reading: Tests

Maria (Masha) Alexeeva edited this page Dec 23, 2021 · 4 revisions

The current testing framework supports testing extractions of mentions with two arguments (e.g., Variable-Definition and Variable-Value) as well as one type of three argument mention (Variable-MinValue-MaxValue), and can be found here.

A test consists of the text value to extract mentions from, the statement of what the test is supposed to find, a sequence that contains the desired extractions, the extraction of mentions, and running the test:

  val t1b = "In APSIM, water uptake (Ta, mm d−1) is determined from potential transpiration demand (Tp, mm d−1), soil " +
    "water available (WA, mm d−1), and water supply (WS, mm d−1) for each ith day and soil layer as:"
  passingTest should s"find definitions from t1b: ${t1b}" taggedAs(Somebody) in {
    val desired = Seq(
      "Ta" -> Seq("water uptake"),
      "Tp" -> Seq("potential transpiration demand"),
      "WA" -> Seq("soil water available"),
      "WS" -> Seq("water supply")
    )
    val mentions = extractMentions(t1b)
    testDefinitionEvent(mentions, desired)
}

The full battery of tests currently implemented can be found here.

To run individual test files, run the following:

sbt 'testOnly <package_name>.<test_class_name>'

For example, to run Description tests, run:

 sbt 'testOnly org.clulab.aske.automates.text.TestDescriptions'

We additionally have alignment tests and serialization tests

Clone this wiki locally