Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7569183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:06:25+00:00 2026-05-30T15:06:25+00:00

I am trying to run a set of tests on multiple XML documents. I

  • 0

I am trying to run a set of tests on multiple XML documents. I want to get a list of product IDs from a config file, and then run the same set of tests on every document. However, when I do this, I cannot get a single final summary of the test stats.

Sample code is below:

import org.scalatest._
import org.scalatest.matchers.ShouldMatchers._
import scala.xml._
import dispatch._

class xyzSpec(webcli: Http, productId: String) extends FeatureSpec with GivenWhenThen with ShouldMatchers {

    feature("We get up to date xyz data from xyzsystem with correct blahblah info") {
    info("As a programmer")
    info("I want to lookup a product in xyzsystem")
    info("So that I can check the date updated and blahblah info")
    scenario("We have an up to date product with correct blahblah info") {
        given("Product " + productId)
            // code to get product XML doc
        when("when we request the db record")
            // code to get crosscheck data from SQL db
        then("we can get the product record") 
            // code to compare date updated
        and("date updated in the XML matches the SQL db")   

   }
  }

}

val h = new Http

val TestConfXml = h(qaz <> identity)
ProdIdsXml \\ "product" foreach {  (product) =>
    val productId = (product \ "@id").text
    new xyzSpec(h, productId).execute(stats=true)        

}

The third last line has a foreach which invokes the test runner multiple times. I know that I can nest test objects (or is that test classes) but I cannot see how to do this dynamically at runtime, when the test class constructor takes parameters.

What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:06:27+00:00Added an answer on May 30, 2026 at 3:06 pm

    Rather than call execute on each suite you create, just collect them then return them from nestedSuites of a suite. And call execute on that outer suite.

    scala> import org.scalatest._
    import org.scalatest._
    
    scala> class NumSuite(num: Int) extends Suite {
         |   override def suiteName = "NumSuite(" + num + ")"
         | }
    defined class NumSuite
    
    scala> val mySuites = for (i <- 1 to 5) yield new NumSuite(i)
    mySuites: scala.collection.immutable.IndexedSeq[NumSuite] = Vector(NumSuite@3dc1902d,     NumSuite@6ee09a07, NumSuite@5ba07a6f, NumSuite@4c63c68, NumSuite@72a7d24a)
    
    scala> stats.run(Suites(mySuites: _*))
    Run starting. Expected test count is: 0
    Suites:
    NumSuite(1):
    NumSuite(2):
    NumSuite(3):
    NumSuite(4):
    NumSuite(5):
    Run completed in 16 milliseconds.
    Total number of tests run: 0
    Suites: completed 6, aborted 0
    Tests: succeeded 0, failed 0, ignored 0, pending 0
    All tests passed.
    

    Voila!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying run a program from a qmake .pro file which modifies the
I'm trying to get a node-set from a xsl variable for calculating. But my
I set up all my certificates and keys today and am trying to run
I'm trying to set up Eclipse to run and deploy my projects to a
I was trying use a set of filter functions to run the appropriate routine,
I am trying to set up a basic Silverlight application to run behind the
I'm trying to write a shell script that, when run, will set some environment
I have 4 threads, and I am trying to set thread 1 to run
I am trying to run selenium tests as part of build. I have a
i'm trying to set up a server for integration tests (specs actually) via ruby

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.