Forum Discussion

ChandanD's avatar
ChandanD
Contributor
4 years ago

Image is getting recongnised on my machine but it is not getting recognised on Jenkins.

Hello,

 

Can anyone tell me why the image is not getting highlighted on Jenkins whereas it is working fine on development environment. 

function testfunc()
{
  Delay(1000)
    /// Launching latest version of teststand designer application
    var TestStandD = Aliases.TestStandDesigner
    //if(TestStandD.Exists) { TestStandD.Close(); TestStandD.Terminate() }
     
    var TestStandDCtrl = Aliases.TeststandDesignerCtrl
    //if (TestStandDCtrl.Exists) { TestStandDCtrl.Close();  TestStandDCtrl.Terminate() }
    var path = Project.Path
    Log.Message(path)
    //var StrApplName = "C:\\KBData\\TSD\\TeststandDesigner\\Lib\\Assembly\\TeststandDesignerCtrl.exe"
    var StrApplName = path+"..\\..\\..\\TestStandDesigner\\Lib\\Assembly\\TeststandDesignerCtrl.exe"
    Log.Message(StrApplName)
    TestedAppIndex= TestedApps.Add(StrApplName)
    TestedApps.Items(TestedAppIndex)
    TestedApps.Items(TestedAppIndex).Run() 
    var titleBar=Aliases.TestStandDesigner.HwndSource_ShellView
    Mainform = TestStandD.WaitAliasChild("HwndSource_ShellView",50000)
    titleBar.SetFocus()
    titleBar.Activate()
    titleBar.Maximize()   
    Log.Message("Teststand Designer Application Launched")
    Delay(1000)
    
    //Open Project file
    var driveraddteststand = DDT.ExcelDriver(path+"\\TestData\\PrjData.xlsx","OpenFile",true)
    while(!driveraddteststand.EOF())
    { 
       var menupanel = TestStandD.FindChild(Array("ClrClassName","ClrFullClassName"),Array("Menu","System.Windows.Controls.Menu"),100)
       menupanel.WPFMenu.Click("Project|Open")
       OF = TestStandD.WaitWindow("#32770","Open Project File",1,10000)
       TestStandD.RefreshMappingInfo()
             
       var project_file = TestStandD.FindChild(Array("WndCaption"),Array("Open Project File"),100)
       project_file.OpenFile(path+ DDT.CurrentDriver.Value(0))
       //Delay(1000)
       Log.Picture(Sys.Desktop, "Tested application is being closed...!!!")
       var picture = ImageRepository.SetVersion.Designer
       Log.Picture(Sys.Desktop, "Tested application is being closed...!!!")
       if(picture.Exists())
       { 
          picture.Click()
          Log.Picture(Sys.Desktop)
          Sys.Keys("[Enter]")

          var pckverpanel = TestStandDCtrl.FindChild(Array("ClrClassName","WinFormsControlName"),Array("UpdateOrSetVersionDialog","UpdateOrSetVersionDialog"),100)
          pckverpanel.Activate()
          pckverpanel.SetFocus()
          pckverpanel.Click()
          var SetVersionBtn = pckverpanel.FindChild(Array("ClrClassName","WinFormsControlName"),Array("Button","setVersionButton"),100)
          SetVersionBtn.Click()
          var SetVersionForm = TestStandDCtrl.FindChild(Array("ClrClassName","WinFormsControlName"),Array("SetVersionForm","SetVersionForm"),100)
          var newver = SetVersionForm.FindChild(Array("ClrFullClassName","WinFormsControlName"),Array("System.Windows.Forms.ComboBox","newVersionComboBox"),100)
          newver.Click()
          newver.Keys("[Down]")
          var SetVerB = TestStandDCtrl.FindChild(Array("ClrFullClassName","WinFormsControlName"),Array("System.Windows.Forms.Button","setVersionButton"),100)
          SetVerB.Click()
          var Openfile = TestStandDCtrl.FindChild(Array("ClrFullClassName","WinFormsControlName"),Array("System.Windows.Forms.Button","openFileButton"),100)
          Openfile.Click()
          Log.Message("Version set process completed")

          
        }    
        else
        {
          Log.Message("No Change in Version number / Cannot find the message box") 
        }
        var GeneralDataAdapter = Aliases.TestStandDesigner.HwndSource_TaskPluginWrapperView
        var update = GeneralDataAdapter.FindChild(Array("ClrFullClassName","WPFControlName"), Array("System.Windows.Controls.TextBlock","Step"),500)
        val = update.Text.OleValue
        var str = "TSD updated\r\n[Ready]"
        while(val.Exists=true )
        {       
          val = update.Text.OleValue
          if(val==str)
          break
        }

        var closeBtn = GeneralDataAdapter.FindChild(Array("ClrClassName","WPFControlText"),Array("Button","Close"),100)
        closeBtn.Click()
        Delay(500)
        
        driveraddteststand.Next()
        
    }
        DDT.CloseDriver(driveraddteststand.Name)
        var ExitApp = menupanel.WPFMenu.Click("Project|Exit")
        TestedApps.TerminateAll()          
        TestedApps.Clear();
}

 

 

6 Replies

  • Hi @chand,

    When you say its not getting recognized on Jenkins you mean to say its running on a different environment? If it is running on a different environment you might want to try capturing the images again specifically for that environment. Keep in mind that image recognition requires each pixel to match if the resolution is not the same it wont work. 

    • ChandanD's avatar
      ChandanD
      Contributor

      Both the system are Windows 10, Test Complete,Test Execute version are same. Application is also same.

      Only I can see is screen resolution is different in development environment and Jenkins environment. 

      Ideally if I use image recognization then both are same. 

  • I have found a workaround solution. If anyone is interested to know let me know

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Hi ChandanD ! I am glad to hear you found a workaround!

       

      It would be highly appreciated if you could share it in this thread!