Beispiel #1
0
 public myConnectForVanelife_http(CaseProtocol yourCaseProtocol, string yourDev_key, string yourDev_secret, string yourDefault_url)
 {
     caseProtocol = yourCaseProtocol;
     dev_key      = yourDev_key;
     dev_secret   = yourDev_secret;
     default_url  = yourDefault_url;
 }
Beispiel #2
0
 public MyExecutionDeviceResult(CaseProtocol yourCaseProtocol, string yourSpanTime, string yourStartTime, string yourBackContent) : this()
 {
     caseProtocol = yourCaseProtocol;
     spanTime     = yourSpanTime;
     startTime    = yourStartTime;
     backContent  = yourBackContent;
     expectMethod = CaseExpectType.judge_default;
 }
 public myConnectForSsh(CaseProtocol yourCaseProtocol, string yourHost, string yourUser, string yourPassword, string yourExpectPattern)
 {
     caseProtocol  = yourCaseProtocol;
     host          = yourHost;
     user          = yourUser;
     password      = yourPassword;
     expectPattern = yourExpectPattern;
 }
 public MyMySqlExecutionContent()
 {
     errorMessage = null;
     caseProtocol = CaseProtocol.unknownProtocol;
     caseActuator = "";
     sqlContent   = new caseParameterizationContent();
     isPosition   = false;
 }
 public myConnectForCom(CaseProtocol yourCaseProtocol, string yourPortName, int yourBaudRate, MyCommonHelper.NetHelper.SerialPortParity yourParity, int yourDataBits, MyCommonHelper.NetHelper.SerialPortStopBits yourStopBits, Encoding yourEncoding)
 {
     caseProtocol = yourCaseProtocol;
     portName     = yourPortName;
     baudRate     = yourBaudRate;
     parity       = yourParity;
     dataBits     = yourDataBits;
     stopBits     = yourStopBits;
     encoding     = yourEncoding;
 }
 public myConnectForTelnet(CaseProtocol yourCaseProtocol, string yourHost, int yourPort, string yourUser, string yourPassword, Encoding yourEncoding, string yourExpectPattern)
 {
     caseProtocol  = yourCaseProtocol;
     host          = yourHost;
     port          = yourPort;
     user          = yourUser;
     password      = yourPassword;
     encoding      = yourEncoding;
     expectPattern = yourExpectPattern;
 }
Beispiel #7
0
 public MyConsoleExecutionContent()
 {
     errorMessage      = null;
     caseProtocol      = CaseProtocol.unknownProtocol;
     caseActuator      = "";
     showContent       = new caseParameterizationContent();
     staticDataSetList = new List <KeyValuePair <string, caseParameterizationContent> >();
     staticDataAddList = new List <StaticDataAdd>();
     staticDataDelList = new List <KeyValuePair <bool, caseParameterizationContent> >();
 }
Beispiel #8
0
 public myCaseLaodInfo(string tempVal)
 {
     ErrorMessage = "";
     remark       = name = content = tempVal;
     id           = 0;
     times        = 1;
     caseType     = CaseType.Unknown;
     caseProtocol = CaseProtocol.unknownProtocol;
     actions      = new Dictionary <CaseResult, CaseAction>();
 }
Beispiel #9
0
 public myConnectForActiveMQ(CaseProtocol yourCaseProtocol, string yourBrokerUri, string yourClientId, string yourFactoryUserName, string yourFactoryPassword, List <string> yourQueueList, List <KeyValuePair <string, string> > yourTopicList)
 {
     caseProtocol    = yourCaseProtocol;
     brokerUri       = yourBrokerUri;
     clientId        = yourClientId;
     factoryUserName = yourFactoryUserName;
     factoryPassword = yourFactoryPassword;
     queuesList      = yourQueueList;
     topicList       = yourTopicList;
 }
Beispiel #10
0
 public MyRunCaseData(T yourContent, int yourId, CaseProtocol yourcontentProtocol)
 {
     errorMessages   = null;
     testContent     = yourContent;
     id              = yourId;
     contentProtocol = yourcontentProtocol;
     actions         = null;
     caseExpectInfo  = new myExpectInfo();
     caseAttribute   = new myCaseAttribute();
 }
Beispiel #11
0
 public MyVaneHttpExecutionContent(string tempVal)
 {
     errorMessage         = null;
     caseExecutionContent = new caseParameterizationContent();
     httpMethod           = tempVal;
     httpTarget           = tempVal;
     caseActuator         = tempVal;
     myHttpMultipart      = new HttpMultipart();
     myHttpAisleConfig    = new HttpAisleConfig();
     caseProtocol         = CaseProtocol.unknownProtocol;
 }
        public MyActiveMQExecutionContent()
        {
            errorMessage = null;
            caseProtocol = CaseProtocol.unknownProtocol;
            caseActuator = "";

            producerDataSendList       = new List <KeyValuePair <ProducerData, caseParameterizationContent> >();
            consumerSubscribeList      = new List <ConsumerData>();
            unConsumerSubscribeList    = new List <ConsumerData>();
            consumerMessageReceiveList = new List <ConsumerData>();
        }
Beispiel #13
0
 public MyRunCaseData(T yourContent, int yourId, CaseProtocol yourcontentProtocol, string yourErrorMessage)
 {
     errorMessages = new List <string>();
     errorMessages.Add(yourErrorMessage);
     testContent     = yourContent;
     id              = yourId;
     contentProtocol = yourcontentProtocol;
     actions         = null;
     caseExpectInfo  = new myExpectInfo();
     caseAttribute   = new myCaseAttribute();
 }
 public MyComExecutionContent()
 {
     errorMessage       = null;
     caseProtocol       = CaseProtocol.unknownProtocol;
     caseActuator       = "";
     comContentToSend   = new caseParameterizationContent();
     comSendEncoding    = null;
     isSend             = false;
     comReceiveEncoding = null;
     isReceive          = false;
     comSleepTime       = -1;
 }
Beispiel #15
0
 public MyBasicHttpExecutionContent()
 {
     errorMessage      = null;
     caseProtocol      = CaseProtocol.unknownProtocol;
     caseActuator      = "";
     httpUri           = new caseParameterizationContent();
     httpMethod        = "";
     httpHeads         = new List <KeyValuePair <string, caseParameterizationContent> >();
     httpBody          = new caseParameterizationContent();
     myHttpAisleConfig = new HttpAisleConfig();
     myMultipartList   = new List <HttpMultipart>();
 }
Beispiel #16
0
        public string additionalError;                                  //case 错误的辅助备注 (主要是请求本身失败或错误)

        public MyExecutionDeviceResult()
        {
            caseId        = 0;
            caseProtocol  = CaseProtocol.unknownProtocol;
            requestTime   = null;
            spanTime      = null;
            startTime     = null;
            caseTarget    = null;
            backContent   = null;
            expectMethod  = CaseExpectType.judge_default;
            expectContent = null;
            result        = CaseResult.Unknow;
            staticDataResultCollection = null;
            additionalRemark           = null;
            additionalError            = null;
        }
 public myConnectForHttp(CaseProtocol yourCaseProtocol, string yourDefault_url, int yourTimeOut, bool yourIsShowResponseHeads, bool yourIsUseDefaultCookieContainer, Encoding yourRequestEncoding, Encoding yourResponseEncoding)
 {
     caseProtocol = yourCaseProtocol;
     default_url  = yourDefault_url;
     if (yourTimeOut > 0)
     {
         timeOut = yourTimeOut;
     }
     isShowResponseHeads         = yourIsShowResponseHeads;
     isUseDefaultCookieContainer = yourIsUseDefaultCookieContainer;
     if (yourRequestEncoding != null)
     {
         requestEncoding = yourRequestEncoding;
     }
     if (yourResponseEncoding != null)
     {
         responseEncoding = yourResponseEncoding;
     }
 }
 public MySshExecutionContent()
 {
     errorMessage = null;
     caseProtocol = CaseProtocol.unknownProtocol;
     sshContent   = new caseParameterizationContent();
 }
 public MyTelnetExecutionContent()
 {
     errorMessage  = null;
     caseProtocol  = CaseProtocol.unknownProtocol;
     telnetContent = new caseParameterizationContent();
 }
Beispiel #20
0
 public myTreeTagInfo_(CaseType yourCaseType, XmlNode yourXmlNode, CaseProtocol yourCaseProtocol)
 {
     tagCaseType     = yourCaseType;
     tagCaseProtocol = yourCaseProtocol;
     tagCaseXmlNode  = yourXmlNode;
 }
Beispiel #21
0
 public myTreeTagInfo_(CaseType yourCaseType, XmlNode yourXmlNode)
 {
     tagCaseType     = yourCaseType;
     tagCaseProtocol = CaseProtocol.unknownProtocol;
     tagCaseXmlNode  = yourXmlNode;
 }
Beispiel #22
0
 public MyExecutionDeviceResult(CaseProtocol yourCaseProtocol, string yourSpanTime, string yourStartTime, string yourBackContent, string yourAdditionalContent) : this(yourCaseProtocol, yourStartTime, yourStartTime, yourBackContent)
 {
     additionalError = yourAdditionalContent;
 }
Beispiel #23
0
        /// <summary>
        /// i will get a myRunCaseData that will give caseActionActuator from XmlNode
        /// </summary>
        /// <param name="yourRunNode">your XmlNode</param>
        /// <returns>myRunCaseData you want</returns>
        public static MyRunCaseData <ICaseExecutionContent> GetCaseRunData(XmlNode sourceNode)
        {
            MyRunCaseData <ICaseExecutionContent> myCaseData = new MyRunCaseData <ICaseExecutionContent>();
            CaseProtocol contentProtocol = CaseProtocol.unknownProtocol;

            if (sourceNode == null)
            {
                myCaseData.AddErrorMessage("Error :source data is null");
            }
            else
            {
                if (sourceNode.Name == "Case")
                {
                    #region Basic information
                    if (sourceNode.Attributes["id"] == null)
                    {
                        myCaseData.AddErrorMessage("Error :not find the ID");
                    }
                    else
                    {
                        try
                        {
                            myCaseData.id = int.Parse(sourceNode.Attributes["id"].Value);
                        }
                        catch (Exception)
                        {
                            myCaseData.AddErrorMessage("Error :find the error ID");
                        }
                    }
                    myCaseData.name = CaseTool.GetXmlAttributeVauleEx(sourceNode, "remark", "NULL");
                    #endregion

                    #region Content
                    //XmlNode tempCaseContent = sourceNode.SelectSingleNode("Content"); //sourceNode["Content"] 具有同样的功能
                    XmlNode tempCaseContent = sourceNode["Content"];
                    if (tempCaseContent == null)
                    {
                        myCaseData.AddErrorMessage("Error :can not find Content");
                    }
                    else
                    {
                        if (tempCaseContent.Attributes["protocol"] != null && tempCaseContent.Attributes["actuator"] != null)
                        {
                            try
                            {
                                contentProtocol            = (CaseProtocol)Enum.Parse(typeof(CaseProtocol), tempCaseContent.Attributes["protocol"].Value);
                                myCaseData.contentProtocol = contentProtocol;
                            }
                            catch
                            {
                                myCaseData.AddErrorMessage("Error :error protocol in Content");
                            }
                            switch (contentProtocol)
                            {
                            case CaseProtocol.console:
                                myCaseData.testContent = CaseProtocolExecutionForConsole.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.activeMQ:
                                myCaseData.testContent = CaseProtocolExecutionForActiveMQ.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.mysql:
                                myCaseData.testContent = CaseProtocolExecutionForMysql.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.ssh:
                                myCaseData.testContent = CaseProtocolExecutionForSsh.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.vanelife_http:
                                myCaseData.testContent = CaseProtocolExecutionForVanelife_http.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.http:
                                myCaseData.testContent = CaseProtocolExecutionForHttp.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.tcp:
                                myCaseData.testContent = CaseProtocolExecutionForTcp.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.telnet:
                                myCaseData.testContent = CaseProtocolExecutionForTelnet.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.com:
                                myCaseData.testContent = CaseProtocolExecutionForCom.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.vanelife_comm:
                                myCaseData.AddErrorMessage("Error :this protocol not supported for now");
                                break;

                            case CaseProtocol.vanelife_tcp:
                                myCaseData.AddErrorMessage("Error :this protocol not supported for now");
                                break;

                            case CaseProtocol.vanelife_telnet:
                                myCaseData.AddErrorMessage("Error :this protocol not supported for now");
                                break;

                            case CaseProtocol.defaultProtocol:
                                myCaseData.AddErrorMessage("Error :this protocol not supported for now");
                                break;

                            default:
                                myCaseData.AddErrorMessage("Error :this protocol not supported for now");
                                break;
                            }
                            if (myCaseData.testContent != null)
                            {
                                if (myCaseData.testContent.MyErrorMessage != null)  //将testContent错误移入MyRunCaseData,执行case时会检查MyRunCaseData中的错误
                                {
                                    myCaseData.AddErrorMessage("Error :the Content not analyticaled Because:" + myCaseData.testContent.MyErrorMessage);
                                    //return myCaseData;
                                }
                            }
                        }
                        else
                        {
                            myCaseData.AddErrorMessage("Error :can not find protocol or actuator in Content");
                        }
                    }
                    #endregion

                    #region Expect
                    XmlNode tempCaseExpect = sourceNode["Expect"];
                    if (tempCaseExpect == null)
                    {
                        myCaseData.caseExpectInfo.myExpectType = CaseExpectType.judge_default;
                    }
                    else
                    {
                        if (tempCaseExpect.Attributes["method"] != null)
                        {
                            try
                            {
                                myCaseData.caseExpectInfo.myExpectType = (CaseExpectType)Enum.Parse(typeof(CaseExpectType), "judge_" + tempCaseExpect.Attributes["method"].Value);
                            }
                            catch
                            {
                                myCaseData.AddErrorMessage("Error :find error CaseExpectType in Expect");
                                myCaseData.caseExpectInfo.myExpectType = CaseExpectType.judge_default;
                            }
                        }
                        else
                        {
                            myCaseData.caseExpectInfo.myExpectType = CaseExpectType.judge_is;
                        }
                        myCaseData.caseExpectInfo.myExpectContent = CaseTool.GetXmlParametContent(tempCaseExpect);
                    }
                    #endregion

                    #region Action
                    XmlNode tempCaseAction = sourceNode["Action"];
                    if (tempCaseAction != null)
                    {
                        if (tempCaseAction.HasChildNodes)
                        {
                            foreach (XmlNode tempNode in tempCaseAction.ChildNodes)
                            {
                                CaseResult tempResult = CaseResult.Unknow;
                                CaseAction tempAction = CaseAction.action_unknow;
                                try
                                {
                                    tempResult = (CaseResult)Enum.Parse(typeof(CaseResult), tempNode.Name);
                                }
                                catch
                                {
                                    myCaseData.AddErrorMessage(string.Format("Error :find error CaseAction in Action with [{0}] in [{1}]", tempNode.InnerXml, tempNode.Name));
                                    continue;
                                }
                                try
                                {
                                    tempAction = (CaseAction)Enum.Parse(typeof(CaseAction), "action_" + CaseTool.GetXmlAttributeVauleWithEmpty(tempNode, "action"));
                                }
                                catch
                                {
                                    myCaseData.AddErrorMessage(string.Format("Error :find error CaseAction in Action with [{0}] in [{1}]", tempNode.InnerXml, CaseTool.GetXmlAttributeVauleWithEmpty(tempNode, "action")));
                                    continue;
                                }
                                if (tempNode.InnerText != "")
                                {
                                    myCaseData.AddCaseAction(tempResult, new CaseActionDescription(tempAction, tempNode.InnerText));
                                }
                                else
                                {
                                    myCaseData.AddCaseAction(tempResult, new CaseActionDescription(tempAction, null));
                                }
                            }
                        }
                    }
                    #endregion

                    #region Attribute
                    XmlNode tempCaseAttribute = sourceNode["Attribute"];
                    if (tempCaseAttribute != null)
                    {
                        if (tempCaseAttribute.HasChildNodes)
                        {
                            if (tempCaseAttribute["Delay"] != null)
                            {
                                try
                                {
                                    myCaseData.caseAttribute.attributeDelay = int.Parse(tempCaseAttribute["Delay"].InnerText);
                                }
                                catch
                                {
                                    myCaseData.AddErrorMessage("Error :find error Delay data in Attribute");
                                }
                            }
                            if (tempCaseAttribute["Level"] != null)
                            {
                                try
                                {
                                    myCaseData.caseAttribute.attributeLevel = int.Parse(tempCaseAttribute["Level"].InnerText);
                                }
                                catch
                                {
                                    myCaseData.AddErrorMessage("Error :find error Level data in Attribute");
                                }
                            }
                            if (tempCaseAttribute["ParameterSave"] != null)
                            {
                                if (tempCaseAttribute["ParameterSave"].HasChildNodes)
                                {
                                    foreach (XmlNode tempNode in tempCaseAttribute["ParameterSave"].ChildNodes)
                                    {
                                        if (tempNode.Name == "NewParameter")
                                        {
                                            string          tempParameterName       = CaseTool.GetXmlAttributeVaule(tempNode, "name");
                                            string          tempParameterMode       = CaseTool.GetXmlAttributeVaule(tempNode, "mode");
                                            string          tempParameterAdditional = CaseTool.GetXmlAttributeVaule(tempNode, "additional");
                                            string          tempFindVaule           = tempNode.InnerText;
                                            PickOutFunction tempPickOutFunction     = PickOutFunction.pick_str;
                                            if (tempParameterName == null)
                                            {
                                                myCaseData.AddErrorMessage("Error :can not find name data in NewParameter in Attribute");
                                                continue;
                                            }
                                            if (tempParameterName == "")
                                            {
                                                myCaseData.AddErrorMessage("Error :the name data in NewParameter is empty in Attribute");
                                                continue;
                                            }
                                            if (tempParameterMode == null)
                                            {
                                                myCaseData.AddErrorMessage("Error :can not find mode data in NewParameter in Attribute");
                                                continue;
                                            }
                                            if (tempFindVaule == "")
                                            {
                                                myCaseData.AddErrorMessage("Error :the NewParameter vaule is empty in Attribute");
                                                continue;
                                            }
                                            try
                                            {
                                                tempPickOutFunction = (PickOutFunction)Enum.Parse(typeof(PickOutFunction), "pick_" + tempParameterMode);
                                            }
                                            catch
                                            {
                                                myCaseData.AddErrorMessage("Error :find error ParameterSave mode in Attribute");
                                                continue;
                                            }
                                            myCaseData.caseAttribute.addParameterSave(tempParameterName, tempFindVaule, tempPickOutFunction, tempParameterAdditional);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    myCaseData.AddErrorMessage("Error :source data is error");
                }
            }
            return(myCaseData);
        }
Beispiel #24
0
 public myConnectForConsole(CaseProtocol yourCaseProtocol)
 {
     caseProtocol = yourCaseProtocol;
 }
 public myConnectForTcp(CaseProtocol yourCaseProtocol, string yourHost, int yourPort)
 {
     caseProtocol = yourCaseProtocol;
     host         = yourHost;
     port         = yourPort;
 }
Beispiel #26
0
 public myConnectForHttp(CaseProtocol yourCaseProtocol, string yourDefault_url)
 {
     caseProtocol = yourCaseProtocol;
     default_url  = yourDefault_url;
 }
 public myConnectForMysql(CaseProtocol yourCaseProtocol, string yourConnectStr)
 {
     caseProtocol = yourCaseProtocol;
     connectStr   = yourConnectStr;
 }