nbscala icon indicating copy to clipboard operation
nbscala copied to clipboard

Scalatest: object scalatest is not a member of package org

Open patkoscsaba opened this issue 11 years ago • 1 comments

I simply created a new SBT project, a directory structure to respect Scalatest and SBT requirements, added a test file with the following content into the test directory:

import org.scalatest.FunSuite

class ExampleSuite extends FunSuite {

test("test 2 expected values are equal") { assert(2 === 2) }

test("test 2 values are different and fail") { assert(2 === 3) } }

From SBT I can run the tests, all compiles and reports as expected:

test [info] Compiling 1 Scala source to /home/csaba/Personal/Programming/NetTuts/From Zero to Hello World in Scala/Sources/target/scala-2.10/test-classes... [info] ExampleSuite: [info] - test 2 expected values are equal [info] - test 2 values are different and fail *** FAILED *** [info] 2 did not equal 3 (ExampleSuite.scala:10) [error] Failed: : Total 2, Failed 1, Errors 0, Passed 1, Skipped 0 [error] Failed tests: [error] ExampleSuite [trace] Stack trace suppressed: run 'last test:test' for the full output. error Tests unsuccessful [error] Total time: 1 s, completed May 15, 2013 9:49:34 PM

However NetBeans highlights all the code in the test with red underling and the message: "object scalatest is not a member of package org"

To install Scalatest I just added a line to build.sbt in the project, as described in Scalatest's documentation:

libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test"

I am willing to provide an example project that reproduces this problem if you have any problems reproducing it. Just tell me how to send it to you.

A lot of thanks, and great job with the plugin.

patkoscsaba avatar May 15 '13 19:05 patkoscsaba

Right click in the editor and select "Reset Scala Parser" and then switch to another source file and switch back.

thomassuckow avatar May 23 '13 17:05 thomassuckow