upgrade to JUnit 4

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

upgrade to JUnit 4

hbrands
Administrator
Hey guys,

I just committed changes to upgrade our tests to JUnit 4. A few notes:
  • now JUnit 4.11 and Hamcrest 1.3 is used
  • you don't need to put junit.jar into your ANT lib folder anymore
  • instead, it's downloaded like any other dependency from our site and placed into the tools folder.
  • therefore, you now need ANT version 1.7.0 or higher to build Glazed Lists
  • most of the boilerplate conversion of the tests was done with the help of JUnitConverter
  • I reimplemented the functionality of SwingTestCase and SwtTestCase with the help of JUnit rules:
    • SwingTestRule executes each test method on the Swing thread
    • SwtTestRule executes each test method on the Swt display thread
    • SwtClassRule initializes the Swt display and shell in a dedicated thread once per test class
    • I kept the base classes SwingTestCase and SwtTestCase for now, which were changed to use those rules
    • if you need to run a test method on the main thread, you can use the new @ExecuteOnMainThread annotation
    • see SwingTestRuleTest and SwtTestRuleTest for an example
    • the advantages of this approach:
      • you basically don't need test base classes anymore
      • from JUnit's view, each gui test method is treated like any other test method
        for example they are shown in the Eclipse JUnit runner and a failing gui test method doesn't prevent the other test methods in the class from running
    • a side-effect of this approach is, that @Before and @After methods also get executed on the gui thread, which isn't a big problem I think
  • the Hibernate tests aren't migrated yet, this will be done when upgrading to Hibernate 4
  • more refactorings for using more of JUnits capabilities are outstanding and will be an ongoing work
We have some tests which are failing for a long time.
I suggest to annotate them with @Ignore so you can check more easily if new tests are failing?

I also started pushing snapshots for the next release 1.10:

https://sites.google.com/site/glazedlists/Home/maven
https://maven.java.net/content/repositories/snapshots/net/java/dev/glazedlists/glazedlists_java16/1.10-SNAPSHOT/

Feedback is welcome...

Thanks,
Holger


Reply | Threaded
Open this post in threaded view
|

Re: upgrade to JUnit 4

robeden
Now for Gradle! ;-)

Rob

On Mar 24, 2013, at 11:12 AM, Holger Brands <[hidden email]> wrote:

Hey guys,

I just committed changes to upgrade our tests to JUnit 4. A few notes:
  • now JUnit 4.11 and Hamcrest 1.3 is used
  • you don't need to put junit.jar into your ANT lib folder anymore
  • instead, it's downloaded like any other dependency from our site and placed into the tools folder.
  • therefore, you now need ANT version 1.7.0 or higher to build Glazed Lists
  • most of the boilerplate conversion of the tests was done with the help of JUnitConverter
  • I reimplemented the functionality of SwingTestCase and SwtTestCase with the help of JUnit rules:
    • SwingTestRule executes each test method on the Swing thread
    • SwtTestRule executes each test method on the Swt display thread
    • SwtClassRule initializes the Swt display and shell in a dedicated thread once per test class
    • I kept the base classes SwingTestCase and SwtTestCase for now, which were changed to use those rules
    • if you need to run a test method on the main thread, you can use the new @ExecuteOnMainThread annotation
    • see SwingTestRuleTest and SwtTestRuleTest for an example
    • the advantages of this approach:
      • you basically don't need test base classes anymore
      • from JUnit's view, each gui test method is treated like any other test method
        for example they are shown in the Eclipse JUnit runner and a failing gui test method doesn't prevent the other test methods in the class from running
    • a side-effect of this approach is, that @Before and @After methods also get executed on the gui thread, which isn't a big problem I think
  • the Hibernate tests aren't migrated yet, this will be done when upgrading to Hibernate 4
  • more refactorings for using more of JUnits capabilities are outstanding and will be an ongoing work
We have some tests which are failing for a long time.
I suggest to annotate them with @Ignore so you can check more easily if new tests are failing?

I also started pushing snapshots for the next release 1.10:

https://sites.google.com/site/glazedlists/Home/maven
https://maven.java.net/content/repositories/snapshots/net/java/dev/glazedlists/glazedlists_java16/1.10-SNAPSHOT/

Feedback is welcome...

Thanks,
Holger



Reply | Threaded
Open this post in threaded view
|

Re: upgrade to JUnit 4

hbrands
Administrator
In reply to this post by hbrands
Hey guys,

I finally found some time to refactor the Hibernate-based testcases for JUnit 4.

HibernateTestCase is now the base class.
It uses HibernateClassRule for session factory creation and cleanup.
It uses HibernateTestRule for session creation and cleanup.
Test cases should use the new HibernateConfig annotation to specify mapping files to use.

In addition, I upgraded the Hibernate extension to Hibernate 4.1.12.Final.
Because the Hibernate Core types PersistentCollection, PersistentList and SessionImplementor
were moved to other packages, only Hibernate 4.x is supported in GlazedLists going forward.

Holger

2013/3/24 Holger Brands <[hidden email]>
Hey guys,

I just committed changes to upgrade our tests to JUnit 4. A few notes:
  • now JUnit 4.11 and Hamcrest 1.3 is used
  • you don't need to put junit.jar into your ANT lib folder anymore
  • instead, it's downloaded like any other dependency from our site and placed into the tools folder.
  • therefore, you now need ANT version 1.7.0 or higher to build Glazed Lists
  • most of the boilerplate conversion of the tests was done with the help of JUnitConverter
  • I reimplemented the functionality of SwingTestCase and SwtTestCase with the help of JUnit rules:
    • SwingTestRule executes each test method on the Swing thread
    • SwtTestRule executes each test method on the Swt display thread
    • SwtClassRule initializes the Swt display and shell in a dedicated thread once per test class
    • I kept the base classes SwingTestCase and SwtTestCase for now, which were changed to use those rules
    • if you need to run a test method on the main thread, you can use the new @ExecuteOnMainThread annotation
    • see SwingTestRuleTest and SwtTestRuleTest for an example
    • the advantages of this approach:
      • you basically don't need test base classes anymore
      • from JUnit's view, each gui test method is treated like any other test method
        for example they are shown in the Eclipse JUnit runner and a failing gui test method doesn't prevent the other test methods in the class from running
    • a side-effect of this approach is, that @Before and @After methods also get executed on the gui thread, which isn't a big problem I think
  • the Hibernate tests aren't migrated yet, this will be done when upgrading to Hibernate 4
  • more refactorings for using more of JUnits capabilities are outstanding and will be an ongoing work
We have some tests which are failing for a long time.
I suggest to annotate them with @Ignore so you can check more easily if new tests are failing?

I also started pushing snapshots for the next release 1.10:

https://sites.google.com/site/glazedlists/Home/maven
https://maven.java.net/content/repositories/snapshots/net/java/dev/glazedlists/glazedlists_java16/1.10-SNAPSHOT/

Feedback is welcome...

Thanks,
Holger