0

I have two Scala projects open in Eclipse (the Scala IDE, more precisely). One project is the main project and the other is where I want to place my tests.

If I place a test file (i.e. a class Test1 extends FlatSpec) in my main project, I can right click on the file and choose "Run Configurations", and it offers me to "Run as ScalaTest - File". However, if I copy that same test file to the second project, right clicking doesn't offer that option. Why is that?

If I am not explaining the situation with enough detail, I'll be glad to add more information.

gdiazc
  • 2,108
  • 4
  • 19
  • 30
  • Do you have any compilation errors? Are both projects successfully built? – Iulian Dragos Mar 07 '14 at 16:04
  • Hi. No, no compiler errors in either project. It is a complete mistery to me. However, I made a third project and created all the classes again from scratch, and it worked fine, so I guess I'll never know... – gdiazc Mar 07 '14 at 23:57

1 Answers1

1

From ScalaTest guide:

Using ScalaTest in a Scala project

To use ScalaTest in your Scala project, you must download ScalaTest and include it in build path of your project.

If it is in your build path, you could just create run-configurations for that particular class.

I've had problems in the past with eclipse and not seeing run java application. I just created the run configurations myself.

Mason T.
  • 1,567
  • 1
  • 14
  • 33
  • I tried doing that, but failed. Do you happen to know the important details that must be included in a ScalaTest run configuration? – gdiazc Mar 06 '14 at 21:33
  • @Gonzalo Is scala test in your build path? – Mason T. Mar 06 '14 at 21:35
  • Yes, I have added a ScalaTest jar file to both my projects. – gdiazc Mar 06 '14 at 21:41
  • Although ideally I would only have to add ScalaTest to my testing project. However, since it's not working in my testing project, I have the test classes in the main project also. – gdiazc Mar 06 '14 at 21:44
  • @Gonzalo What options is eclipse giving you when you right click and look at `Run As` – Mason T. Mar 06 '14 at 21:44
  • It said "no options applicable". However, I created a third project an created all the test classes again, from scratch, and it worked. A mystery... – gdiazc Mar 07 '14 at 23:58