continued … Spec Explorer on advanced constraints for combinations


spaces.live.com restricts the size of a blog post.  This is a continuation of the previous just to provide more code and detailed output.

Read the first blog post Spec Explorer on advanced constraints for combinations first! 

 

Config.cord

using Microsoft.Protocols.TestSuites.TravelDates;

 

/// Contains actions of the model, bounds, and switches.

config Base

{

       switch generatedtestpath = "..\TestSuite";

    switch generatedtestnamespace = "Microsoft.Protocols.TestSuites.TravelDates";

    switch ConstraintSolverTimeout = 6000000;   // number of milliseconds before timeout.

    switch StepBound  = 4096;

    switch StateBound = 4096;

}

 

config Interaction : Base

{

       action abstract static string SUT.TravelDates(short DaysToDeparture, short TripLength,

            bool DepartureDay2Digits, bool DepartureMonth2Digits, bool DepartureThisYear,

            bool ReturnDay2Digits, bool ReturnMonth2Digits, bool ReturnThisYear)

            where {.

                           Condition.In(DaysToDeparture, 0,1,2,10,30,60);

                           Condition.In(TripLength, 0,1,2,10,30,60);

                           Combination.Interaction(DaysToDeparture, TripLength

                                        , DepartureDay2Digits, DepartureMonth2Digits, DepartureThisYear

                                        //,  ReturnDay2Digits, ReturnMonth2Digits, ReturnThisYear

                                        );

                           .};

}

 

// 6 * 6 * 2 * 2 * 2  = 288 combinations if all legal   (not combininng final 3 params)

machine Product() : Interaction

{

    TravelDates || (construct model program from Interaction)

}

// But only 215 are legal combinations

machine CartesianTestSuite() : Interaction where TestEnabled = true

{

    construct test cases

        where strategy = "longtests", allowundeterminedcoverage = true

        for Product

}

 

// 288 * 2 * 2 * 2 = 2,304 if all interactions, but if only pairwise then 156 legal are needed.

config PairedInteraction : Base

{

       action abstract static string SUT.TravelDates(short DaysToDeparture, short TripLength,

            bool DepartureDay2Digits, bool DepartureMonth2Digits, bool DepartureThisYear,

            bool ReturnDay2Digits, bool ReturnMonth2Digits, bool ReturnThisYear)

            where {.

                           Condition.In(DaysToDeparture, 0,1,2,10,30,60);  // 6 values

                           Condition.In(TripLength, 0,1,2,10,30,60); // 6 values

                           Combination.Pairwise(DaysToDeparture, TripLength, DepartureDay2Digits, DepartureMonth2Digits, DepartureThisYear

                                                            ,  ReturnDay2Digits, ReturnMonth2Digits, ReturnThisYear);

                           .};

}

machine PairWise() : PairedInteraction

{

    TravelDates || (construct model program from PairedInteraction)

}

 

machine PairWiseTestSuite() : PairedInteraction where TestEnabled = true

{

    construct test cases

        where strategy = "longtests", allowundeterminedcoverage = true

        for PairWise

}

 

 

 

Advertisements

About testmuse

Software Test Architect in distributed computing.
This entry was posted in software testing. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s