Eclipse buildtime and runtime classes to easily run junit test cases

I have a large eclipse project with several junit classes. I am trying to find a balance between adding runtime resources to the eclipse project classpath and having to configure mututiple junit startup configurations.

I understand that the default eclipse buildpath is inherited by all unit test configurations, but some of my tests require additional runtime resources. I could add these resources to the build path, but this slows down my overall build time for the project (since it should contain more files in sync). I do not like the idea of ​​including * resources and cans in the path of the execution path.

Two options that I have are positive and negative cases, as I see, are listed

1: Add all runtime resources to overshadow the classpath.

  • POS I can select unit test and run it without having to set up a test path.
  • POS Additional resources for creating a classpath mean that the eclipse is slowing down.
  • NEG It is more difficult to ensure that the correct resources are used in each test.

2: Set up classpath for each unit test

  • POS I know exactly what resources are used in testing.
  • POS A smaller classpath layout means faster assembly and execution using eclipse.
  • NEG. This is the pain of setting up several separate junit runtime path classes.

junit, eclipse, . junit, ?

junit,

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<stringAttribute key="bad_container_name" value="/CR-3089_5_1_branch."/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/CR-3089_5_1_branch/src/com/x/y/z/ParserJUnitTest.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.x.y.z.ParserJUnitTest"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CR-3089_5_1_branch"/>
</launchConfiguration>

/ 'org.eclipse.jdt.launching.MAIN_TYPE'?

commons , , , , ant. ant target, .

. eclipse buildtime classpath junit runtime?

+3
1

, :

  • JUnit ( , ): dev .

( Eclipse, Eclipse), maven one, m2eclipse .
, maven , .

+1

Source: https://habr.com/ru/post/1738641/


All Articles