The Artima Developer Community
Sponsored Link

ScalaTest/ScalaUtils Forum
ScalaTest + Spring HTML Report

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Gregg Sirrine

Posts: 2
Nickname: gsirrine
Registered: Apr, 2015

ScalaTest + Spring HTML Report Posted: Apr 9, 2015 2:21 PM
Reply to this message Reply
Advertisement
My application requires the use of Spring. I have successfully configure Spring and my components/services are loaded when I run my test. However, I would very much like to make use of the HTML report feature. When I integrate Spring with my ScalaTest project my test cases don't seem to be "registered" with ScalaTest and their results are not included in the HTML report output.

As I compare a simple test case with Spring, to one without, it appears that the problem occurs because I am Autowiring my test cases.

@RunWith(classOf[JUnitRunner])
class PricingSpec extends FunSuite with TestSuite {
 
    test("calculate load share") { 
        test1
    }
 
    @Autowired var test1  : TestCase1 = null
}
 
@ContextConfiguration( value = Array("/wpmClient-context.xml") )
@ActiveProfiles(Array("test"))
trait TestSuite extends BeforeAndAfterAll { this: Suite =>
 
    @Autowired implicit var client: SessionState = null
    @Autowired var testData: TestData = null
 
    override def beforeAll: Unit = {
        new TestContextManager(classOf[TestSuite]).prepareTestInstance(this)
        super.beforeAll
    }
 
    override def afterAll: Unit = {
        println(s"+== Cleaning up sample data...")
    }
}
 
@Component
class TestCase1 @Autowired()(client: SessionState, testData: TestData)
        extends PropSpec with Matchers with GivenWhenThen {
 
    @Autowired private  var blockLoad : BlockLoadService = _
 
    property(s"""Test 1 descriptive text""") {
        markup(s"""##Test Results Scenario: """)
        assert(1===1)
    }
}

*The Spring example above, initializes Spring and loads all of my beans but never runs TestCase1. TestCase1 is not listed in the Suite table of the HTML report.

TestCase1 is never run. I need TestCase1 to be instantiated by Spring as it requires access to various services that are also managed/instantiated by Spring. Any help on how I can make this work would be appreciated.

Topic: ScalaTest check parameters override Previous Topic   Next Topic Topic: Beginner Scala developer, first post, saying hi

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use