How to use PUnit & CUnit

How to use ALBPM PUnit Suite

How to use ALBPM PUnit Suite

PreCondition: Install ALBPM Studio and new one ALBPM Project

 

 

Step 1. Create Roles "user"

Step 2. Create Participant "punit" and assign role "user"

Step 3. New Process "Process1"

Step 4. New instance variable "instanceVar1 : String"

Step 5. Right click "Interactive",choose "Main Task"

       Implementation Type : Method

       New megthod : interactivePunit

       and input code /* instanceVar1 = "OK" */

Step 6. Run process,Please check process run is ok

 

 

Step 1. New Module XXProjectTests

Step 2. New PUnitSuite "Process1Tests"

 

ALBPM Studio auto new two methods "setup" and "tearDown"

 

setup:

session = createSession(participant : "punit")

 

  Comments:

  session : Fuego.Test.ProcessServiceSession

  this.createSession()

 

tearDown:

close session

 

 

Step 3. new method "testMainFlow"

**************************************************************************

instanceId as String

 

log this

    using message = "[Test Begin]"

 

log this

    using message = "Creating process instance"

 

instanceId = processCreateInstance(session, processId : "/Process1")

 

log this

    using message = "Checking instance is running"

   

assertInstanceRunning this

    using session = session,

          instanceId = instanceId

 

log this

    using message = "Waiting for instance stops at interactive activity"

   

waitInstanceStopsAtActivity this

    using session = session,

          instanceId = instanceId,

          activityName = "Interactive",

          timeoutSeconds = 10

         

log this

    using message = "Executing interactive activity"         

         

activityExecute session

    using activityName = "Interactive",

          instanceId = instanceId

 

log this

    using message = "Waiting for instance end"

   

waitInstanceIsCompleted this

    using session = session,

          instanceId = instanceId,

          timeoutSeconds = 30

         

log("Checking instance variable value")                   

object = instanceGetVariable(session, instanceId, "instanceVar1")

assertEquals this

    using a = "OK",

          b = String.valueOf(object)  

         

log this

    using message = "[Test End]"

**************************************************************************

Step 4. Run ALBPM Studio

Step 5. Run test method.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(it)