I have JUnit main test suite. This suite contains many suites - for each testing configuration
@RunWith(ProgressSuite.class)
@SuiteClasses({
SimpleTest.class,
AboutTest.class,
CDH4_JDBC_TestSuite.class,
CDH5_JDBC_TestSuite.class,
CDH4_Metastore_TestSuite.class,
CDH5_Metastore_TestSuite.class,
CDH4_JDBC_Kerberos_TestSuite.class,
CDH5_JDBC_Kerberos_TestSuite.class,
CDH4_Metastore_Kerberos_TestSuite.class,
CDH5_Metastore_Kerberos_TestSuite.class,
})
public class TestSuite {
}
Suites for each testing configuration contains the same test cases, but contains different setUpClass() and tearDownClass() methods
@RunWith(Suite.class)
@SuiteClasses({
PerspectiveSwitchTest.class,
NewFolderFromToolbarTest.class,
RenameFolderFromToolbarTest.class,
RenameFileFromToolbarTest.class,
OpenFilePropertiesFromToolbarTest.class,
OpenFolderPropertiesFromToolbarTest.class,
DeleteFileFromToolbarTest.class,
DeleteFolderFromToolbarTest.class,
CopyPasteFolderFromToolbarTest.class,
CopyPasteFileFromToolbarTest.class,
CutPasteFolderFromToolbarTest.class,
CutPasteFileFromToolbarTest.class,
})
public class CDH4_JDBC_Kerberos_TestSuite {
private static SWTWorkbenchBot bot = new SWTWorkbenchBot();
private static AddNewEcosystemNavigator addNewEcosystemNavigator;
private static EcosystemConfigurationLoader ecosystemConfigurationLoader;
private static EcosystemConfiguration ecosystemConfiguration;
private static GenericNavigator genericNavigator;
@BeforeClass
public static void setUpClass() {
bot = new SWTWorkbenchBot();
addNewEcosystemNavigator = new AddNewEcosystemNavigator();
ecosystemConfigurationLoader = new EcosystemConfigurationLoader();
genericNavigator = new GenericNavigator();
ecosystemConfiguration = ecosystemConfigurationLoader
.getDefaultCDH4JDBCKerberosEcosystemConfiguration();
addNewEcosystemNavigator.addNewEcosystemManually(bot,
ecosystemConfiguration);
}
@AfterClass
public static void tearDownClass() {
genericNavigator.closeDialogWindow();
addNewEcosystemNavigator.discardEcosystem(bot, ecosystemConfiguration);
}
}
I am using Jenkins and Tycho for building tests. When I run test suite and some tests fails, I am not able to distinguish on which configuration tests failed. In Jekins I can see only information e.g NewFolderFromToolbarTest was runned 8 times (3 times failed, 5 times passed). Of course I am able get required information from log, but it is time consuming.
Is there any way how to get required information? e.g Use different test structure, use different jenkins plugin, renamed method dynamically if even possible etc? any ideas please? thanks a lot
You could make the test classes abstract and have each configuration be a subclass
Then in your suite call the specific test classes
I would advocate that instead of reconfiguring in each subclass since the
@BeforeClass
and@AfterClass
will only be called once if it is put in the suite.