Dirty Grails Integral Test 2.0?

So, I have a small integration test in which there are only 5 tests. Running this test solely leads to all tests passed. However, running my entire test suite leads to 4 testing errors 5.

I recently upgraded to grails-2.0 from 1.3.7, and I switched from hsqldb to h2.

Does anyone have any directions in which direction I should look to fix this problem (test pollution)?

Domain model

domain-model

Integration Test:

class SeriesIntegrationTests extends GrailsUnitTestCase { Series series Episode episode protected void setUp() { super.setUp() series = new Series(ttdbId: 2348); episode = new Episode(ttdbId: 2983, season: 0, episodeNumber: 0, series: series); } protected void tearDown() { super.tearDown() } void testCreateSeries() { series.save() assertFalse("should not have validation errors : $series.errors", series.hasErrors()) assertEquals("should be one series stored in db", 1, Series.count()) } void testCreateEpisode() { series.save() episode.save() assertFalse("should not have validation errors : $episode.errors", episode.hasErrors()) assertEquals("should be one episode stored in db", 1, Episode.count()) } void testCreateSeriesAndAddEpisode() { series.addToEpisodes(episode) series.save(flush: true) series.refresh() assertEquals("series should contain one episode", 1, series.episodes.size()) } void testDeleteSeriesAndCascadeToEpisode() { series.addToEpisodes(episode) series.save(flush: true) series.delete(flush: true) assertEquals(0, Episode.count()) assertEquals(0, Series.count()) } void testDeleteSeriesAndCascadeToBackdropImage() { series.backdrop = new Image(); series.backdrop.binaryData = new byte[0] series.save(flush: true) assertFalse(series.hasErrors()) assertEquals(1, Image.count()) series.delete(flush: true) assertEquals(0, Image.count()) } } 
+4
source share
2 answers

My solution is to upgrade all unit tests to the grails 2.0 method for testing. When this was done, every test passed. It seems that the unit is testing somehow dirty integration tests. But only on some hardware configurations.

0
source

I had a similar problem when switching from 1.3.7 to 2.0. Integration tests were approved at startup with

 grails test-app --integration 

but when starting with

 grails test-app 

I fixed everything by converting unit tests to grails 2.0 test (using annotations).

+1
source

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


All Articles