Automate application which build on "Team Developer"

Discussion forum about all things Team Developer 7.x
mahen
India
Posts: 5
Joined: 30 Aug 2018, 12:23
Location: India

Automate application which build on "Team Developer"

Post by mahen » 30 Aug 2018, 13:24

Hello Team,

I am beginner for "Team Develop". I want to automate application's controls(Grid,Table,Button..) which build on "Team Develop".
Via google found the same question here.
https://stackoverflow.com/questions/228 ... ossibility

My Environment - 32-bit trial version of Team Developer 7.1

From above link done small POC. Please look below code with .Net

Code: Select all

[DllImport("user32.dll")]
        static extern IntPtr WindowFromPoint(System.Drawing.Point p);     

        [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Auto)]
        static extern long GetClassName(IntPtr hwnd, StringBuilder lpClassName, long nMaxCount);

        const string guptadllpath = @"C:\program files (x86)\gupta\team developer 7.1\VTI71.DLL";        
        [DllImport(guptadllpath)]
        extern static int VisTblFindString(IntPtr hwndTable, int lStartRow, IntPtr hwndColumn, string lpctszSearchFor);

        IntPtr _wndFromPoint;
        private void MainForm_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                Cursor.Current = Cursors.Default;
                Point p = PointToScreen(e.Location);

                _wndFromPoint = WindowFromPoint(p);

                StringBuilder classText = new StringBuilder(256);
                GetClassName(_wndFromPoint, classText, 256);

                listBox1.Items.Add("Class: " + classText);

                int a = VisTblFindString(_wndFromPoint, 0, IntPtr.Zero, "Pat");

                this.Text = a.ToString();
            }
        }
But give me below error:
System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.


My Sample application is
Image


Please suggest me how to resolve this error.
Is it correct way to use "Team Develop dll in c# for automate?

Thanks,

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1088
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Automate application which build on "Team Develop"

Post by Dave Rabelink » 31 Aug 2018, 07:35

Well, I'm afraid it will be a hell of a task to implement your own tool.
Problem is that not all objects can be accessed from outside. Those objects are not default Windows objects.

I know there were 3rd party tools in the past which had plugins for Team Developer, but none of them will support the latest TD versions.

Here we use a custom build tool (c#) which supports Team Developer applications.
This is done using a custom TD interface which can be called from the tool. The interface acts like a bridge between the external test tool and the TD application.
The custom interface does the actual access to TD objects from within the process itself. This in-house testtool is is a mix between access default Windows objects and usage of the custom TD interface.

Maybe others here know about ways to implement a test tool.

I think that it would be better to use a scripting tool like AutoIt.

https://www.autoitscript.com/site/

Question: do you have access to the TD sources of the application you need to automate? Are you allowed to create custom stuff in TD to support the C# tool?
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

mahen
India
Posts: 5
Joined: 30 Aug 2018, 12:23
Location: India

Automate application which build on "Team Develop"

Post by mahen » 31 Aug 2018, 10:28

do you have access to the TD sources of the application you need to automate? : Let me try first with sample code and than will implement with real code.
Are you allowed to create custom stuff in TD to support the C# tool?: In version 7.1 it allows

Can you guide me if i want automate below sample application? I need only grid value which are display.

My sample application is located below path in my system.
D:\mark.pal\My Documents\Team Developer 7.1\Samples\61Demos\Grid\Splittermeister.app

let me know how to create bridge between the external test tool and the TD sample application.

Can u i create plugin for TD application which can allow to me access TD application UI Control for automation.

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1088
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Automate application which build on "Team Develop"

Post by Dave Rabelink » 31 Aug 2018, 11:22

A way to do this is sending a message to the object within the TD application from the tool instructing the action to perform.

Using WM_COPYDATA message, a custom data object is passed to the TD object. The data contains the action to perform (for instance to fetch the text from a table cell), some additional values like row number als column number)

At the receiving side, the TD object reads the passed data to perform the action.
The result is then put back into a response data object which is then accessible to the tool.

Each object should be derived from a base class, which implements all the actions needed.

As for other objects with are from a WIndows class, like datafields, sending a WM_GETTEXT to the object will get the contents of the field.
Same for clicking them etc etc.

As long as the TD object is a "Windows" object, the normal WinAPI messages/functions can act upon it. Tables in TD are custom objects and will not be able to be queried or managed from outside.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1088
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Automate application which build on "Team Develop"

Post by Dave Rabelink » 31 Aug 2018, 11:28

An example how to implement WM_COPYDATA in TD can be found here (use the 52 version)

http://samples.tdcommunity.net/index.ph ... rch_mode=f
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 134
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Automate application which build on "Team Developer"

Post by thomas.uttendorfer » 31 Aug 2018, 12:17

Hi,
I also made an example for automating a grid.
Very simple example but can be extended.
GridAutomation.zip
Regards Thomas
You do not have the required permissions to view the files attached to this post.
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

mahen
India
Posts: 5
Joined: 30 Aug 2018, 12:23
Location: India

Automate application which build on "Team Developer"

Post by mahen » 31 Aug 2018, 12:59

thomas.uttendorfer wrote:
31 Aug 2018, 12:17
Hi,
I also made an example for automating a grid.
Very simple example but can be extended.
GridAutomation.zip
Regards Thomas
Yes its work fine.
Now i want to convert it in .Net or C++ dll.
After converting it dll, Can i use in my application?

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 134
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Automate application which build on "Team Developer"

Post by thomas.uttendorfer » 31 Aug 2018, 14:50

Hi Mahen,

you have to write your C# or C++ program like GridAutomationClient.apt.
This should not be a big deal.

Regards Thomas
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

mahen
India
Posts: 5
Joined: 30 Aug 2018, 12:23
Location: India

Automate application which build on "Team Developer"

Post by mahen » 31 Aug 2018, 16:06

thomas.uttendorfer wrote:
31 Aug 2018, 14:50
Hi Mahen,

you have to write your C# or C++ program like GridAutomationClient.apt.
This should not be a big deal.
Regards Thomas
Hello Thomas,

I am beginner in TD development. Can you help me to convert GridAutomationClient.apt in C# dll.
do you have any sample program for C# .dll?

Thanks,

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 134
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Automate application which build on "Team Developer"

Post by thomas.uttendorfer » 04 Sep 2018, 08:12

Hi Mahen,
I built an equivalent application of the grid client in C# (Visual Studio 2017).
Talk2Gupta.zip
Regards Thomas
You do not have the required permissions to view the files attached to this post.
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

mahen
India
Posts: 5
Joined: 30 Aug 2018, 12:23
Location: India

Automate application which build on "Team Developer"

Post by mahen » 06 Sep 2018, 13:51

thanks, It works

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests