dimanche 4 août 2019

How to run a single jUnit test on Multiple classes having different names?

I have different classes in the resource package having different names. I need to run a single junit test case on each of the class. But I'm stuck on it that how can I run a single junit testsuite on multiple target classes?

Here, I'm creating a single variable for a single class and test case is running on it. But I need to run the same test case on multiple target classes.

public class multipleTest {

private multiple multipleUnderTest;

@Before
public void setUp() {
    multipleUnderTest = new multiple();
}

@Test
public void testGrade() {
    // Setup
    final int total = 300;
    final char expectedResult = 'C';

    // Run the test
    final char result = multipleUnderTest.grade(total);

    // Verify the results
    assertEquals(expectedResult, result);
}

}

I'm expecting the multiple classes result from a single junit Test. But it is testing a single target class. and need another test case to run on another class.

Aucun commentaire:

Enregistrer un commentaire