testmycode / tmc-intellij

*BETA* TestMyCode plugin for IntelliJ IDEA
MIT License
24 stars 13 forks source link

Working With Test My Code (TMC) plugin. Trying to run a class (Name.java) and and it throws me the "Choose main class" Window #139

Open xscavengerx opened 6 years ago

xscavengerx commented 6 years ago

I encounter the message only when I am working on NHLStatistics part 1.

vilmakoo commented 6 years ago

Try building the project (Build -> Rebuild Project).

jackfterry commented 5 years ago

I had this issue too, but found a fix. I think that the TMC add in doesn't set up and configure the project and correctly when it is first opened.

When selecting a new exercise (with Intellij already open) I have to perform the following actions).

  1. Open and close the project (this loads the project in the project viewer, as it doesn't seem to open automatically).
  2. Open File -> Project Structure -> Project. Select a suitable Project SDK and project language level. Also select a path to put the Project Compiler output in.
  3. Then click on Modules on the left. Click on the "src" folder and then click on "Mark as: Sources". This should add blue writing "Source Folders src" on the right.
  4. Close the dialogue box and click the TMC Run Project green arrow. Intellij should automatically identify the main class which should relate to the exercise you are doing.

It is now possible to run the project, run the tests and submit the code with TMC. I haven't figured out how to automate this, so if anyone figures this out, let me know.

I'm using IntelliJ version 2019.1.1 community edition with TMC v2.0.2

zysktomasz commented 5 years ago

@jackfterry Thanks, your solution was the only thing that worked for me.

tomWhilbert commented 5 years ago

Yes, these directions work! cheers

Adrianczuk commented 5 years ago

@jackfterry Thanks, in addition to the above I had to make an additional step: Set Project language level to 8 inside File -> Project Structure -> Project Also project compiler output should be the test folder

ashleyghooper commented 5 years ago

@jackfterry, you can set the default SDK and language level by going to File | Other Settings | Structure for New Projects. Then you just have to set the compiler output path and mark the src directory as a Sources Root.