Visual Studio 2019 Solution Desktop

Basic knowledge of C# programming and Visual Studio 2019 is required.
It is assumed that you are using the default installation of MyITest4U.

MyITest4U comes with a Visual Studio 2019 Solution (Api.sln). This project can be used to make changes in the behavior of MyITest4U. The project Api.sln is in the folder C:\AutoTest\MyITest4U\TestEngine\CSharp\Api

The following references need to be fixed after opening the project.

  • ApiPrivate.dll
  • Castle.Core.dll
  • log4net.dll
  • TestStack.White.dll
  • Utils.dll

All dlls are found in the folder C:\AutoTest\MyITest4U\TestEngine\CSharp\dll

Logging

The following method can be used for logging:

       
        /// <summary>
        /// Logging example. The log statements can be used anywhere in a method. 
        /// The log will be written to ../MyITest4U/TestLog
        /// </summary>
        public void loggingExample ()
        {
            Exception e = new Exception ();
            Logger.Instance.TestLog ("Will appear in the test log.");
            Logger.Instance.TestLog ("Will appear in the test log showing the exception.", e);

            Logger.Instance.Info ("Will appear in the log.");
            Logger.Instance.Info ("Will appear in the log showing the exception.", e);
        }
    
      

Creating Your Own Actions

MyITest4U allows you to create your own actions. See also the documentation given in the code of the MyConfig class in the method Action.

The custom action needs to be added to the switch case statement. The case name is the action name. The action name has to be unique (no check for uniqueness is done).

error can be used to set an error message in the log. That the error message is shown the custom action needs to return RETURN_FALSE and error needs to be set for cf.ActionError ( cf.ActionError = error;).

After you created your custom action you need to build the project and copy the Api.dll from C:\AutoTest\MyITest4U\TestEngine\CSharp\Api\bin\Release to C:\AutoTest\MyITest4U\TestEngine\CSharp\bin.

The custom action needs to be added to the database to be visible in the editor. This can be done under Config / Custom Action. The action name has to be the case name used to build the action. Description and parameter will show up in the Editor when the action is selected. Further you can define for which ControlTypes your custom action can be used.

A custom action can be updated / deleted by entering the name of the custom action in the Custom Action dialog and clicking on Add followed by Update / Delete.

Handling Of Language Dependent GUI Element Names

At the moment there is no GUI support and no migration support for the handling of language dependent GUI element names.

The table guielementrelease contains a column languagekeyid. This is a foreign key of the languagekey table. The languagekey table has columns for the languagekey as it might be used by the AUT developers and a column for each supported language (add language columns as needed). The column default can be used to show the default name (the name obtained by the spider when inserting the GUI element into the database). The default column is not used to get the default name of the GUI element. The name column of the guielement table is used for the default name.

Language dependent GUI element names can be handled in the following way:

Insert your language dependent GUI element names into the table languagekey. The structure of the languagekey table is given below:

       
        CREATE TABLE public.languagekey
        (
           languagekeyid bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ),
           languagekey character varying(512) COLLATE pg_catalog."default",
           "default" character varying(2048) COLLATE pg_catalog."default",
           de character varying(2048) COLLATE pg_catalog."default",
           CONSTRAINT languagekey_pkey PRIMARY KEY (languagekeyid)
       )
    
      

Open the test containing the language dependent GUI elements.
Get the guielementreleaseid of the language dependent GUI element. The guielementreleaseid is the number behind the Element Name.
Run the following update statement:

       
        Update 
        guielementrelease
        set languagekeyid = <your languagekeyid>
        where guielementreleaseid = <your guielementreleaseid>
    
      

Set the Application language in the Run Configuration of your test to the column name of the language you want to use. If the GUI element name is not set for a language the default name is used. Set the Application language to Default if you do not have language dependent names.

A test run will use the above information to change the language dependent GUI element name for each supported language.

MyConfig

The class MyConfig can be used to fine tune MyITest4U.

How Are GUI Elements Found?

The following GUI element properties are combined for each ControlType and used to find a GUI element:

  • AutomationId
  • ClassName
  • Name
  • HelpText
  • FrameworkId Win32

Further to these search criteria an index can be used for GUI elements which are present more than once.

The GUI element search uses the GUI element properties stored in the MyITest4U database and compares these properties with the actual properties of the GUI element. The stored properties of a GUI element can manipulated in the Spider run before they are stored in the database. Therefore a Spider Configuration can be defined. The class MyConfig contains Handle... methods for each of the above properties (see GUI Element Identifier ). The Spider Configuration name allows to distinguish between different Spider configurations.

The parameter file can be used to change the GUI element properties in a test run e.g. A user dependent Window Title can be handled using the parameter file which belongs to the test (see Variable Identifier Parts ).