-
Notifications
You must be signed in to change notification settings - Fork 442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
junit Testing #837
Comments
@Zirhi Could you share your sample project here? |
Hi, do you want only the test file? I am not allowed to share the project on public sites as it is a school assignment |
@Zirhi Do you have add the junit as the project dependency? |
The assignment doesn't specify, but if it helps I think I can do that. |
So I tried the procedure from the provide gif in #501 I created a lib folder and used the command user$ cp ../lib/*.jar lib/ Returned |
or is that not what solves my problem |
Issue has been resolved |
So what solved it? |
I downloaded these two files from junit.org/junit4/ https://github.com/junit-team/junit4/wiki/Download-and-Install Seems to get rid of the resolving error |
So I do not get the red line error on my import statements anymore, but on compiling the program I still get this error: TestOne.java:1: error: package org.junit does not exist |
compiling as in calling javac from a terminal? If that's the case, you need to add the jars to the classpath.
and, to run the class:
if you're on Mac or Linux, the path separator is If you google about how to set the Java classpath, you'll find alternative ways of doing it like in https://howtodoinjava.com/java/basics/java-classpath/ Now in vscode-java, all that is not necessary, as compilation happens under the hood, and if you installed the Java Debugger extension and/or the Java Test runner, you'll be able to run your code directly from within VS Code, by clicking on "code lenses". |
So I am writing a test file for a program.
The instruction requires me to use:
import static org.junit.Assert.*;
import org.junit.Test;
However, when I get an error: The import org.junit cannot be resolvedJava(268435846)
Please what is this issue and how do I go about resolving it.
The text was updated successfully, but these errors were encountered: