Skip to content

DRAFT: JUnitFlow

Christian Carter edited this page Jul 12, 2017 · 1 revision

JUnitFlow

Basics & Usage

A subclass of BaseFlow that allows you to report the entire flow as one testsuite.

At the flow level, declare the name of the results file:

    test_data_bdi:
        class_path: cumulusci.core.flow.JUnitFlow
        description:  'WARNING: This flow deletes all data first, then loads a random data set via mockaroo'
        junit_results: test_results.xml
        tasks:
            1:
                task: test_data_delete

Each step in the flow that declares a junit config becomes a testcase in the results:

            5:
                task: batch_apex_wait
                options: 
                    class_name: BDI_DataImport_BATCH
                junit:
                    name: 1000 contact, account, address, donation
                    time: ^^self.duration

Implementation

JUnitFlow will hook into _run_task...somehow.

junit.rnc

Relax NG Compact Syntax Schema for the test_results.xml file. Source

start = testsuite 

property = element property { 
   attribute name {text}, 
   attribute value {text} 
} 

properties = element properties { 
   property* 
} 

failure = element failure { 
   attribute message {text}, 
   attribute type {text}, 
   text 
} 

testcase = element testcase { 
   attribute classname {text}, 
   attribute name {text}, 
   attribute time {text}, 
   failure? 
} 

testsuite = element testsuite { 
   attribute errors {xsd:integer}, 
   attribute failures {xsd:integer}, 
   attribute hostname {text}, 
   attribute name {text}, 
   attribute tests {xsd:integer}, 
   attribute time {xsd:double}, 
   attribute timestamp {xsd:dateTime}, 
   properties, 
   testcase*, 
   element system-out {text}, 
   element system-err {text} 
} 
#---------------------------------------------------------------------------------- 
Clone this wiki locally