Question: Assignment: Create a test Java Project called TEST in Eclipse Create a new package Create a new Class called HelloSoftwareTesting with the following code -
Assignment:
Create a test Java Project called TEST in Eclipse
Create a new package
Create a new Class called HelloSoftwareTesting with the following code - Click Here
Create your JUnit test for the HelloSoftwareTesting class
Set up and run your JUnit test in Eclipse and provide a screenshot of test results in the JUnit view.
Note: The Help Menu in Eclipse shows you in great detail how to set up and run a Junit test. (Writing and Running JUnit tests)
Expected results: Green means success and failures is 0.
My code:
package test;
public class HelloSoftwareTesting {
private String name = "";
public String getName()
{
return name;
}
public String getMessage()
{
if (name == "")
{
return "Hello Software Testing is Fun!";
}
else
{
return "Hello " + name + "! Software Testing is Fun!;
}
}
public void setName(String name)
{
this.name = name;
}
}
My Junit test code:
package test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class HelloSoftwareTestingTest {
@Test
void SoftwareTestingTest() {
fail("Not yet implemented");
}
}
Question: Why is it failing? What can I do to sort out the issue and make it work?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
