//--------------------------------------------------------------------------- #ifndef MainH #define MainH //--------------------------------------------------------------------------- #include #include #include #include #include #include #include #include #include #include #include "Grids_ts.hpp" #include "TSDBGrid.hpp" #include "TSGrid.hpp" #include #include #include #include #include #include "TXMLSchema.h" #include "AdvGrid.hpp" #include "BaseGrid.hpp" #include #include "DBAdvNavigator.hpp" #include "AdvPageControl.hpp" #include "AsgFindDialog.hpp" #include "DBAdvGrd.hpp" #include "DBAdvGrid.hpp" #include "ProgressBar.h" #include #include #include typedef map TXNIndexMap; typedef pair TXNIndexPair; typedef map IterationParams; typedef pair IterationParamsPair; typedef struct { string name; unsigned int increment; unsigned int initial_value; unsigned int reset_at; unsigned int value; } IterationSequence; typedef map IterationSequences; typedef pair IterationSequencesPair; typedef struct { int txnscenario_no; int txnspec_no; int fieldtag; AnsiString fieldname; int subscript; AnsiString fieldvalue; AnsiString xpath; char user_supplied; } TxnSpecValue; typedef map TxnSpecValueMap; typedef map::iterator TxnSpecValueIterator; typedef pair TxnSpecValuePair; typedef map FoundTxnSpecValueMap; typedef pair FoundTxnSpecValuePair; typedef map::iterator FoundTxnSpecValueIterator; class DefinedVariableTable; class Iteration; class ISecurityWrapperFactory; class SequenceCollection; class TestScenario; class TransactionSpecification; #include "SecurityWrapper.h" #include "TransactionCache.h" #include "TransactionTemplateCollection.h" using namespace std; //--------------------------------------------------------------------------- class TMainForm : public TForm { __published: // IDE-managed Components TPanel *Panel1; TPanel *Panel2; TSplitter *Splitter1; TToolBar *ToolBar1; TMainMenu *MainMenu1; TMenuItem *Help1; TMenuItem *About1; TToolButton *ToolButton1; TLabel *Label1; TLabel *Label2; TSpeedButton *ProjectConfigBtn; TSpeedButton *IterationConfigBtn; TComboBox *ProjectsComboBox; TComboBox *IterationsComboBox; TPanel *Panel4; TBitBtn *ImportXMLSchemaBtn; TADOQuery *MASSTxnsQuery; TDataSource *MASSTxnsDataSource; TADOQuery *TestScenariosQuery; TDataSource *TestCasesDataSource; TActionList *ActionList1; TAction *EditTestCase; TADOQuery *TxnSpecQuery; TDataSource *TxnSpecDataSource; TPanel *Panel3; TADOQuery *TxnValuesQuery; TDataSource *TxnValuesDataSource; TPanel *Panel8; TImageList *ImageList1; TADOQuery *TestCaseQuery; TDataSource *TestCaseEditDataSource; TPanel *Panel9; TDBMemo *DBMemo2; TLabel *Label4; TBitBtn *SaveUseCaseEditBtn; TADOQuery *IterationParamsQuery; TDataSource *IterationParamsDataSource; TPopupMenu *ScenarioPopupMenu; TMenuItem *NewTransaction; TAction *NewTransactionAction; TAction *DeleteTransactionAction; TPanel *TestCasePanel; TPanel *Panel6; TSplitter *Splitter2; TToolBar *TestScenarioToolBar; TToolButton *ToolButton2; TSpeedButton *AddTestCaseNode; TToolButton *ToolButton4; TSpeedButton *TestCaseZoomIn; TSpeedButton *TestCaseZoomOut; TTreeView *TestCaseTreeView; TPanel *Panel7; TAction *RunTestCase; TPanel *Panel10; TPanel *Panel5; TToolBar *ToolBar4; TToolButton *ToolButton8; TSpeedButton *ImportTestDirector; TBitBtn *ApplyTemplates; TToolButton *ToolButton9; TtsDBGrid *tsDBGrid3; TADOQuery *TxnStepsQuery; TDataSource *TxnStepsDataSource; TSplitter *Splitter3; TPanel *Panel11; TDBMemo *DBMemo3; TSplitter *Splitter4; TPanel *Panel12; TDBMemo *DBMemo4; TLabel *Label5; TLabel *Label6; TDBNavigator *DBNavigator3; TtsDBGrid *tsDBGrid6; TADOQuery *TxnHdrValuesQuery; TDataSource *TxnHdrValuesDataSource; TDBNavigator *DBNavigator4; TtsDBGrid *tsDBGrid4; TMenuItem *N1; TMenuItem *ScenarioParameters; TADOQuery *SequenceGeneratorQuery; TDataSource *SequenceGeneratorDataSource; TPopupMenu *TxnValuesPopupMenu; TMenuItem *RemoveUserSuppliedValue; TBitBtn *GenerateTestTestCaseBtn; TMenuItem *ApplyTemplatesToScenario; TMemo *TxnFieldComments; TSplitter *Splitter5; TLabel *Label3; TEdit *FieldDatatype; TPanel *Panel13; TLabel *Label7; TListBox *FieldEnumValues; TStringField *TxnValuesQueryFIELDNAME; TStringField *TxnValuesQueryXPATH; TStringField *TxnValuesQueryPROJECT_CODE; TBCDField *TxnValuesQueryITERATION; TStringField *TxnValuesQueryUSER_SUPPLIED; TIntegerField *TxnValuesQuerySUBSCRIPT; TBCDField *TxnValuesQueryFIELDTAG; TStringField *TxnValuesQueryFIELDVALUE; TStringField *TxnValuesQueryNOTES; TBCDField *TxnValuesQueryTXNSPEC_NO; TBCDField *TxnValuesQueryTESTSCENARIO_NO; TStringField *TxnValuesQueryDISPLAY_FIELDNAME; TToolBar *ToolBar5; TDBAdvNavigator *DBAdvNavigator1; TDBAdvNavigator *PayloadStructureNavigator; TAdvPageControl *TestsPageControl; TAdvTabSheet *TestCaseTabSheet; TAdvTabSheet *ParamsTabSheet; TAdvTabSheet *MASSTxnTabSheet; TStringField *TestCaseQueryUSECASE_ID; TStringField *TestCaseQueryNAME; TStringField *TestCaseQueryDESCRIPTION; TStringField *TestCaseQueryTESTCASE_ID; TStringField *TestCaseQueryTRACEABILITY_REF; TStringField *TestCaseQueryREF_TYPE; TStringField *TestCaseQueryUSE_CASE_TYPE; TMenuItem *N2; TMenuItem *Properties1; TPopupMenu *TransactionPopupMenu; TMenuItem *DeleteTransaction; TMenuItem *DeleteScenario; TAction *DeleteScenarioAction; TAction *InitialiseTransactionAction; TMenuItem *InitialiseTransaction; TXMLSchema *XMLSchema; TAdvPageControl *TestParametersPageControl; TAdvTabSheet *IterationParametersTabSheet; TAdvTabSheet *BatchHeaderParametersTabSheet; TAdvTabSheet *SequenceGeneratorsTabSheet; TAdvTabSheet *CopyParametersTabSheet; TBitBtn *Copy; TComboBox *SourceIterationComboBox; TADOStoredProc *CopyIterationProcedure; TDBAdvStringGrid *TestCaseGrid; TDBAdvStringGrid *DBAdvStringGrid2; TDBAdvStringGrid *DBAdvStringGrid3; TAdvPageControl *AdvPageControl1; TAdvTabSheet *AdvTabSheet1; TAdvTabSheet *AdvTabSheet2; TDBAdvGrid *NewPayloadStructureGrid; TDBAdvStringGrid *TransactionValueGrid; TAdvPageControl *TransactionStructurePageControl; TAdvTabSheet *PayloadStructureTabSheet; TAdvTabSheet *NewPayloadStructureTabSheet; TAdvTabSheet *HeaderStructureTabSheet; TBCDField *TxnValuesQueryORDINAL; TBCDField *TxnValuesQueryCHILD_COUNT; TStatusBar *MainStatusBar; TAdvTabSheet *ObsoleteFieldTabSheet; TDBAdvNavigator *ObsoleteFieldNavigator; TDBAdvStringGrid *ObsoleteFieldGrid; TDBAdvNavigator *HeaderStructureNavigator; TDBAdvStringGrid *HeaderStructureGrid; TDBAdvNavigator *NewPayloadStructureNavigator; TADOQuery *TxnHeaderValuesQuery; TStringField *StringField1; TStringField *StringField2; TStringField *StringField3; TBCDField *BCDField1; TStringField *StringField4; TIntegerField *IntegerField1; TBCDField *BCDField2; TStringField *StringField5; TStringField *StringField6; TBCDField *BCDField3; TBCDField *BCDField4; TStringField *StringField7; TBCDField *BCDField5; TBCDField *BCDField6; TDataSource *TxnHeaderValuesDataSource; TADOQuery *TxnObsoleteValuesQuery; TStringField *StringField8; TStringField *StringField9; TStringField *StringField10; TBCDField *BCDField7; TStringField *StringField11; TIntegerField *IntegerField2; TBCDField *BCDField8; TStringField *StringField12; TStringField *StringField13; TBCDField *BCDField9; TBCDField *BCDField10; TStringField *StringField14; TBCDField *BCDField11; TBCDField *BCDField12; TDataSource *TxnObsoleteValuesDataSource; TAdvPageControl *MainPageControl; TAdvTabSheet *TestCasesTabSheet; TAdvTabSheet *TestScenariosTabSheet; TAdvTabSheet *ScenarioStepsTabSheet; TAdvTabSheet *AdvTabSheet4; TAdvTabSheet *AdvTabSheet5; TAdvTabSheet *AdvTabSheet6; TToolButton *ToolButton3; TAdvGridFindDialog *TransactionValueGridFindDialog; TAdvGridFindDialog *HeaderStructureGridFindDialog; TAdvGridFindDialog *ObsoleteFieldGridFindDialog; TADOQuery *SequenceGeneratorValueQuery; TDataSource *SequenceGeneratorValueDataSource; TDBAdvStringGrid *SequenceGeneratorsGrid; TDBAdvNavigator *SequenceGeneratorNavigator; TEdit *DocDataType; TLabel *Label8; TMenuItem *ImportTransactions; TAction *ImportTransactionAction; TSpeedButton *IterationCopyButton; TMenuItem *Generate; TAction *GenerateAction; TCheckBox *IncludedInMac; void __fastcall ProjectConfigBtnClick(TObject *Sender); void __fastcall IterationConfigBtnClick(TObject *Sender); void __fastcall FormShow(TObject *Sender); void __fastcall ProjectsComboBoxChange(TObject *Sender); void __fastcall tsDBGrid2RowChanged(TObject *Sender, Variant &OldRow, Variant &NewRow); void __fastcall EditTestCaseExecute(TObject *Sender); void __fastcall UseCaseDBGridEnter(TObject *Sender); void __fastcall TestCaseTreeViewEnter(TObject *Sender); void __fastcall TestCaseQueryAfterPost(TDataSet *DataSet); void __fastcall IterationsComboBoxChange(TObject *Sender); void __fastcall IterationParamsQueryAfterInsert(TDataSet *DataSet); void __fastcall ImportXMLSchemaBtnClick(TObject *Sender); void __fastcall TestCaseTreeViewChange(TObject *Sender, TTreeNode *Node); void __fastcall NewTransactionActionExecute(TObject *Sender); void __fastcall DeleteTransactionActionExecute(TObject *Sender); void __fastcall TestCaseZoomInClick(TObject *Sender); void __fastcall TestCaseZoomOutClick(TObject *Sender); void __fastcall AddTestCaseNodeClick(TObject *Sender); void __fastcall TestCaseTreeViewEndDrag(TObject *Sender, TObject *Target, int X, int Y); void __fastcall TestCaseTreeViewStartDrag(TObject *Sender, TDragObject *&DragObject); void __fastcall TestCaseTreeViewDragOver(TObject *Sender, TObject *Source, int X, int Y, TDragState State, bool &Accept); void __fastcall ApplyTemplatesClick(TObject *Sender); void __fastcall ImportTestDirectorClick(TObject *Sender); void __fastcall TxnHdrValuesQueryAfterInsert(TDataSet *DataSet); void __fastcall ScenarioParametersClick(TObject *Sender); void __fastcall TestCaseTreeViewMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y); void __fastcall TxnValuesQueryBeforePost(TDataSet *DataSet); void __fastcall RemoveUserSuppliedValueClick(TObject *Sender); void __fastcall CopyValuesToClipboardBtnClick(TObject *Sender); void __fastcall GenerateTestTestCaseBtnClick(TObject *Sender); void __fastcall ApplyTemplatesToScenarioClick(TObject *Sender); void __fastcall FieldEnumValuesDblClick(TObject *Sender); void __fastcall FormClose(TObject *Sender, TCloseAction &Action); void __fastcall SetGenerationDirectoryClick(TObject *Sender); void __fastcall TestCaseGridRowChanging(TObject *Sender, int OldRow, int NewRow, bool &Allow); void __fastcall TestCaseQueryAfterClose(TDataSet *DataSet); void __fastcall TestCaseQueryAfterOpen(TDataSet *DataSet); void __fastcall SequenceGeneratorQueryAfterInsert(TDataSet *DataSet); void __fastcall TestCaseQueryBeforePost(TDataSet *DataSet); void __fastcall TestCaseTreeViewEditing(TObject *Sender, TTreeNode *Node, bool &AllowEdit); void __fastcall TestCaseTreeViewEdited(TObject *Sender, TTreeNode *Node, AnsiString &S); void __fastcall TestScenarioPropertiesClick(TObject *Sender); void __fastcall TestCaseTreeViewContextPopup(TObject *Sender, TPoint &MousePos, bool &Handled); void __fastcall DeleteScenarioClick(TObject *Sender); void __fastcall InitialiseTransactionActionExecute(TObject *Sender); void __fastcall InitialiseCopyParametersTabSheet(TObject *Sender); void __fastcall CopyClick(TObject *Sender); void __fastcall TransactionValueGrid1BeforeContractNode(TObject *Sender, int ARow, int ARowReal, bool &Allow); void __fastcall TransactionValueGridCanEditCell(TObject *Sender, int ARow, int ACol, bool &CanEdit); void __fastcall TransactionValueGridGetDisplText(TObject *Sender, int ACol, int ARow, AnsiString &Value); void __fastcall TransactionValueGridRowChanging(TObject *Sender, int OldRow, int NewRow, bool &Allow); void __fastcall ObsoleteFieldGridRowChanging(TObject *Sender, int OldRow, int NewRow, bool &Allow); void __fastcall HeaderStructureGridRowChanging(TObject *Sender, int OldRow, int NewRow, bool &Allow); void __fastcall HeaderStructureTabSheetShow(TObject *Sender); void __fastcall PayloadStructureTabSheetShow(TObject *Sender); void __fastcall ObsoleteFieldTabSheetShow(TObject *Sender); void __fastcall MainStatusBarResize(TObject *Sender); void __fastcall TransactionValueGridKeyDown(TObject *Sender, WORD &Key, TShiftState Shift); void __fastcall HeaderStructureGridKeyDown(TObject *Sender, WORD &Key, TShiftState Shift); void __fastcall ObsoleteFieldGridKeyDown(TObject *Sender, WORD &Key, TShiftState Shift); void __fastcall ImportTransactionActionExecute(TObject *Sender); void __fastcall IterationCopyButtonClick(TObject *Sender); void __fastcall GenerateActionExecute(TObject *Sender); private: // User declarations TXNIndexMap m_mass_txns; AnsiString m_testteamcode; AnsiString m_currentproject; int m_currentiteration; string m_schema_handle; int m_testscenario_no; int m_txnspec_no; string m_structure_name; TRegistry * m_Registry; vector< string > m_xml_schemas; TTreeNode * m_startnode; std::vector< int > m_parents; TransactionCache m_transactionCache; TransactionTemplateCollection m_transactionTemplates; ProgressBar * m_progressBar; HINSTANCE m_securityWrapper; getSecurityWrapperFactory_t m_getSecurityWrapperFactory; ISecurityWrapperFactory * m_securityWrapperFactory; void __fastcall InitialiseMASSTxns(); void __fastcall InitialiseTxnParams(unsigned int schema_format_version, IterationParams &iteration_params, IterationSequences &iteration_sequences); void __fastcall InitialiseTestScenario(unsigned int testscenario_no, TxnSpecValueMap &txnSpecValueMap, FoundTxnSpecValueMap &foundTxnSpecValueMap, IterationSequences &iteration_sequences, IterationParams &iteration_params); string __fastcall FindField(const string &structure_name, int fieldtag); void LoadProjectCombo(); void __fastcall LoadTestCaseNodes(TTreeNode *testcase_node); void __fastcall ResequenceTestCases(TTreeNode *testcase_node); void __fastcall ResequenceTransactions(TTreeNode *testcase_node); void __fastcall ProcessTxnStructure(string structure_handle, unsigned short udtype, unsigned short udsubtype, int testscenario_no, int txnspec_no, TADOQuery *query, TxnSpecValueMap &txnSpecValueMap, FoundTxnSpecValueMap &foundTxnSpecValueMap, IterationParams &iteration_params, IterationSequences &iteration_sequences, unsigned int nested_subscript); AnsiString LookupParameter(IterationParams &iteration_params, IterationSequences &iteration_sequences, TADOQuery *query, int testscenario_no, const string ¶m, unsigned short udtype, unsigned short udsubtype); static AnsiString & getNameFromNode( AnsiString & name, const AnsiString & string ); void __fastcall populateHeaderStructureTab( const AnsiString & structure ); void __fastcall populatePayloadStructureTab( const AnsiString & structure ); void __fastcall populateObsoleteStructureTab( void ); void __fastcall buildTransactionSpecificationValues( TransactionCache & transactionCache, const int & testScenario, const int & transactionSpecification, const std::string & transactionStructureName, const std::string & headerStructureName, const std::string & schema, const int & iteration ); void __fastcall buildTransactionSpecificationFieldValue( TADOQuery & query, const std::string & rootStructure, const std::string & fieldHandle, const int & testScenario, const int & transactionSpecification, int & ordinal, const & childCount, TransactionSpecification & transactions, const int & subscript = 0 ); void __fastcall buildTransactionSpecificationRepeatValue( TADOQuery & query, const std::string & rootStructure, const std::string & attribute, const int & testScenario, const int & transactionSpecification, const std::string & transactionStructureHandle, int & ordinal, TransactionSpecification & transactions, const int & repeatLimit = 1000 ); void __fastcall buildTransactionSpecificationValues( TADOQuery & query, const std::string & rootStructure, const int & testScenario, const int & transactionSpecification, const std::string & transactionStructureHandle, int & ordinal, TransactionSpecification & transactions ); const unsigned __fastcall countChildren( const std::string & transactionStructureHandle, const bool & isStructureRepeat ); const unsigned __fastcall countChildren( const std::string & attribute, const std::string & transactionStructureHandle, const int & repeatLimit = 1000 ); void __fastcall clearTransactionSpecificationValueTree( TDBAdvGrid & grid ); void __fastcall buildTransactionSpecificationValueTree( TDBAdvGrid & grid, TADOQuery & query ); static const int countChildNodes( TDBAdvGrid & grid, TADOQuery & query, const int & row, const int & rows ); void __fastcall getParentOrdinals( std::vector< int > & parents ); const bool __fastcall isParent( const int & ordinal ); void __fastcall readTransactionSpecifications( TransactionSpecification & transaction, const int & transactionSpecification ); void __fastcall obsoleteTransactionSpecifications( const TransactionSpecification & transaction ); void __fastcall TransactionGridRowChanging( TADOQuery & query, const char * structureName ); void __fastcall buildTransactionTemplates( TransactionTemplateCollection & templates, const AnsiString & project, const int & iteration ); void __fastcall loadLegacyHeaderValues( TransactionTemplateCollection & templates, const AnsiString & project, const int & iteration ); void __fastcall loadLegacyParameters( TransactionTemplateCollection & templates, const AnsiString & project, const int & iteration ); void __fastcall applyTemplatesToScenario( ProgressBar & progressBar, const int & scenario ); void __fastcall applyTemplatesToTransaction( ProgressBar & progressBar, const int & transaction, const TestScenarioTemplate * testScenario, const TestScenarioTemplate * all ); const unsigned __fastcall countTransactionsInScenario( const int & scenario ); const unsigned __fastcall countTransactionsInIteration( const char * project, const int & iteration ); void __fastcall buildTransactionsForIteration( TransactionCache & transactionCache, ProgressBar & progressBar, const std::string & schema, const std::string & project, const int & iteration ); void __fastcall buildTransactionsForScenario( TransactionCache & transactionCache, ProgressBar & progressBar, const int & scenario, const std::string & schema, const int & iteration ); void __fastcall buildExecutionSchedule( Iteration & iteration, const std::string & testcaseId ); void __fastcall buildExecutionSchedule( TestScenario & testScenario ); void __fastcall buildExecutionSchedule( TransactionSpecification & transactionSpecification ); const bool __fastcall findSchema( std::string & handle, const AnsiString & projectCode, const int & iteration ); void __fastcall loadLegacyVariables( DefinedVariableTable & variables, const AnsiString & project, Iteration & iteration ); const bool __fastcall openSecurityFactory( const char * library = "SecurityWrapper.dll" ); void __fastcall closeSecurityFactory(); void __fastcall readSequences( SequenceCollection & sequences, const std::string & project, const int & iteration ); void __fastcall writeSequences( const SequenceCollection & sequences, const std::string & project, const int & iteration ); void __fastcall importTransaction( const int & testScenarioNumber, const AnsiString & profile, const AnsiString & file ); void __fastcall generateTransaction( std::vector< int > & scenarios ); public: // User declarations __fastcall TMainForm(TComponent* Owner); __fastcall virtual ~TMainForm(); static const char * g_headerStructure; static const int g_messagePanel; }; //--------------------------------------------------------------------------- extern PACKAGE TMainForm *MainForm; //--------------------------------------------------------------------------- #endif