Difference between revisions of "RU/development/qa/vcltesttool/introduction"

From Wiki
Jump to navigationJump to search
(переводим...)
(</center>)
Line 123: Line 123:
  
 
{| class="prettytable"
 
{| class="prettytable"
  |colspan="2" | [[Image: Testtool-option-crashreport.jpg]]
+
  |colspan="2" | <center>[[Image: Testtool-option-crashreport.jpg]]</center>
 
  |-
 
  |-
 
  |1. '''Use Proxy'''
 
  |1. '''Use Proxy'''

Revision as of 10:30, 11 April 2010

Template:RU/documentation/beingedited Template:RU/documentation/helpneeded



Инструментарий для автоматического тестирования OpenOffice.org

О TestTool

TestTool - это программа, предназначенная для автоматизированного тестирования OpenOffice.org. TestTool взаимодействует через TCP/IP-интерфейс с OpenOffice.org и выполняет тестирование установленного на PC OpenOffice.org. Текущая выерсия TestTool предназначена для работы с OpenOffice.org 3.0 и выше. Однако, в будущем в OpenOffice.org могут быть внесены несовместимые изменения и потребуется обновить версию TestTool.

TestTool связывается с OpenOffice.org, используя SlotIDs, UniqueIDs, и HelpIDs для управления каждым пунктом меню, окнами, диалогами, и диалоговыми параметрами в OpenOffice.org. Идентификаторы генерируются автоматически в OpenOffice.org посторителями процессов или назначаются разработчиками.


SlotIDs Каждый пункт меню имеет SlotID который используется, например, чтобы открыть диалог или совершить действие.
HelpIDs Каждый элемент управления, окно или диалог автоматически получает HelpID для внутренней справочной системы. TestTool использует HelpIDs для идентификации конкретного элемента управления, окна или диалога.
UniqueIDs Разработчики могут назначать UniqueID элементам управления, которые не имеют собственного HelpID, чтобы TestTool мог идентифицировать данный котрол.


Вы можете создать скрипт теста для TestTool на языке программирования StarBasic (подобный VisualBasic). Некоторые команды доступны для TestTool, например, получить или разместить информацию в элементе управления OpenOffice.org. Есть полный список доступных команд, описывающий внутренние команды, методы, и функции TestTool [en]. Вы можете симулировать большинство действий мыши и клавиатуры из TestTool, а так же собирать информацию из элементов управления или изменять установки по умолчанию в OpenOffice.org. Иными словами, TestTool позволяет симулировать поведение пользователя OpenOffice.org.

Расположение TestTool

Окружающая среда TestTool может быть проверена на Mercurial в openoffice.org, и находится в каталоге: testautomation; Или она доступна в виде отдельно пакета.

Приложение TestTool всегда доступно для загрузки. Для других платформ установка так же доступна. Просто используйте двоичный файл из каталога

.../{officepath}/program.

Запустите программу

Documentation linux.png testtool.bin


или

Documentation windows.png testtool.exe


или

Documentation Mac Logo 40.png скопируйте скрипт soffice в testtool и запустите его.


Установка TestTool

Для установки TestTool, распакуйсте содержимое загруженного архива TestTool на локальный диск. Если TestTool планируют использовать несколько пользователей, скопируйте распакованный архив на сетевой диск.

После запуска TestTool выполняет файл настроек

Documentation linux.png .testtoolrc


или

Documentation windows.png testtool.ini


Если ваш файл настроек TestTool расположен в том же каталоге, что и исполняемые файлы TestTool, то он автоматически буде скопирован в каталог

Documentation linux.png home


или

Documentation windows.png профиль



Documentation linux.png Только для Linux: Если вы получили сообщение, аналогичное этому:

"Couldn't bootstrap uno servicemanager for reason : Couldn't create registry file ...services.rdb for writing",
убедитесь, что вы используете nfslock.
Например, в Linux запустите
/etc/init.d/nfslock status
Если команда не выполняется, то измените от имени root и выполните
/etc/init.d/nfslock start и
chkconfig nfslock on.
Это необходимо для дистрибутивов TurboLinux и SuSe 8.1.


Настройка TestTool

Выберите Extra → Settings → Profile.

Testtool-option-profile.jpg
1. Profile: Введите название вашего профиля.
2. Log base directory: Введите путь, куда будут сохраняться результаты тестов.
Например:
Documentation linux.png /opt/qa/qatesttool/errorlog/mymachine


или

Documentation windows.png d:\qa\qatesttool\errorlog\mymachine


3. Base directory: Введите полный путь к Окружению TestTool (БЕЗ завершающего слэша!).
Например:
Documentation linux.png /opt/qa/qatesttool


или

Documentation windows.png d:\qa\qatesttool


4. Default HID directory: Отметьте данный флажок.


При необходимости можно изменить эти настройки в соответствующем конфигурационном файле

Documentation linux.png .testtoolrc


Documentation windows.png testtool.ini



CurrentProfile=_profile_Default
(...)
[_profile_Default]
LogBaseDir=/opt/qa/qatesttool/errorlog/mymachine
BaseDir=/opt/qa/qatesttool
HIDDir=/opt/qa/qatesttool/global/hid

Автоматизированные креш-отчёты

Выберите меню Extra → Settings → Crashreport.


Testtool-option-crashreport.jpg
1. Use Proxy Выберите, если доступ в интернет осуществляется через прокси.
2. Host Адрес прокси. Например:
proxy.somewhere.de
3. Port Введите номер порта прокси. Например:
8080
4. Allow Contact Отметьте этот флажок, если вы разрешите отправлять вам письма касательно ваших креш-отчётов.
5. Email Адрес вашей электропочты. Например:
you@somewhere.de


В последствии можно отредактировать все эти параметры в конфигурационных файлах

Documentation linux.png .testtoolrc


Documentation windows.png testtool.ini



[Crashreporter]
UseProxy=true
ProxyServer=proxy.somewhere.de
ProxyPort=8080
AllowContact=true
ReturnAddress=you@somewhere.de

Выбор установки OpenOffice.org

Есть два варианта:

Выберите меню Extra → Settings → Misc.

Testtool-option-misc.jpg
1. OOo Program Dir Выберите установку OpenOffice.org, предназначенного для тестирования. Например:
/Volumes/OpenOffice.org 2.0.app/Contents/MacOS


В последствии можно отредактировать все эти параметры в конфигурационных файлах

Documentation linux.png .testtoolrc


Documentation windows.png testtool.ini


[OOoProgramDir]
Type=Path
Current=/Volumes/OpenOffice.org 2.0.app/Contents/MacOS
All=/Volumes/OpenOffice.org 2.0.app/Contents/MacOS

TestTool Editor

The TestTool uses syntax highlighting for all BASIC, StarBasic, and internal TestTool commands (For more information, see: Internal Commands, Methods and Functions for TestTool). Highlighting can increase the load time for large files.

Starting a TestTool Script

Start local OpenOffice.org installations using the TestTool command line parameter -enableautomation. In the TestTool Environment, executable scripts use the *.bas extension. To run a script, load a *.bas-file, and then run the script from the menu or with a shortcut.


Tt run.jpg
F5 Start
Starts the script, opens a new or old result file, and inserts the result of the test in the file.

F8 Single stepping

Runs the script by single steps.

F10 Single step over procedures

Runs the script one sub routine at a time.

F9 Set / Select a break point

Creates a breakpoint (red circle) in the script on the blue border on the left side.
Shift+F5 Cancel
Cancels a running script.

Ctrl+F5 Interrupt

Interrupts a running script.

Shift+F8 Next Error

Jumps to the next error after a syntax error in a script.

Shift+F7 Previous Error

Jumps to the previous error in a script.

Result File

The TestTool automatically saves a result file during a test script is run. The name of the result file is the name of the script *.bas-file that generated the result, but with the *.res extension (For example: first.bas - first.res). To set the path for saving the result file, choose Extra - Settings - Profile and enter the path in the Log Base directory box.

If a result file already exists, the file is opened and the new result is added at the beginning of the file.

The results are presented as a hierarchical tree list where you can click plus sign (+) or minus sign (-) to expand or collapse the outputs.

Tt result.png

  • The first output is Reading the files. Expand this entry to see the declaration files. If the entry is orange, the declaration files (*.win / *.sid) contain errors. The sum of the errors is displayed at the end of a test as Warnings occurred during initialization.
  • The next output is a short entry that is generated automatically by the start up routines. The entry displays information about the TestTool version, the paths where OpenOffice.org is installed, and where the application was started. The office- and the system language is also displayed.
  • Each entry that has a [+] in front of it is a testcase. If the testcase entry is a color other than black, the test contains errors.
  • An orange testcase indicates that one or more warnings are present. To see where the error occurred, expand the entry and examine the warnlogs, which are the outputs from the developer of the test script. To jump directly to the place in the test script where a warning occurred, double-click the warning.
  • A light green testcase indicates a QAErrorLog entry that was inserted by the developer of the testcase to give the tester some information (for example, about an existing bug or workaround)
  • A light blue testcase indicates an Assertion that gives selectable informatoins when testing a debug build of OpenOffice.org.
  • A red testcase indicates that one or more errors are present. The tree is expanded to display the error(s). In the example result file, the error occurred when the TestTool did not find the slot. That is because there is a typo in it ‚Äì it should be ToolsOptions.
  • When you expand a red entry by clicking the plus sign (+) in front of the entry, a level by level (sub main - testcase ... - subroutine ... - .....) view of the error is displayed. You can also see what the TestTool did to return OpenOffice.org to a defined base state so that the TestTool can run the next testcase without any open windows or dialogs.For example:
    • the WORKINGWINDOW "Untitled2 - OpenOffice.org Writer" is closed (geschlossen = closed)
    • Explanation:
    • the working document is closed
    • The TestTool then started the next testcase at the base state of OpenOffice.org (that is, with one open document and no open dialog).
  • At the end of a test, the number of errors and warnings is displayed

Starting a Test Script From the Command Line

To start a test-script from the command line, use the following syntax:


testtool.exe [/port=xxx /host=xxx] startprogram /run [/result xxx] [/printlog]
/Port
The com port on the machine that the TestTool uses to communicate with OpenOffice.org. If you do not include this parameter, the TestTool looks for relevant information in the .testtoolrc or testtool.ini files.
/Host
The hostname of the machine that contains the OpenOffice.org installation that you want to test. If the installation is on the same machine as the TestTool, enter localhost. If you do not include this parameter, the TestTool looks for relevant information in the .testtoolrc or testtool.ini files.(only localhost is supported)
Startprogram
The *.bas-file that contains the main-routine.
/run
Runs the test script, writes the result to the result file, and exits the TestTool at the end of the test.
/result
Limits the number of testruns to xxx excluding the current one in the resultfile (0,1,2,...). The action gets executed on running the testcase.
/printlog
write the information written to logs on stdout ***** UNIX only ! *****
Example: testtool.exe /port=12481 /host=localhost /opt/qatesttool/writer/update/w_update.bas /run
The TestTool runs the w_update.bas-test on the local machine through port 12481, and exits the TestTool when the test is done.

Run a Batch with Testcases

There are examples for Win32 and Unix at http://hg.services.openoffice.org/DEV300/file/1467f46f8817/testautomation/tools/run_tests.

Testing a Non-Product Version

  • Define the files where you want to store the debug-settings for OpenOffice.org by inserting the following section into the win.ini file (If you don't have access to the file, you may use environment variables.):
 [SV]
 dbgsv=c:\dbgsv.ini
 dbgsvlog=c:\dbgsv.log 
  • On Linux/Unix/Win32 Platforms you have to set an environment variable to control where the debug-settings are stored:
 DBGSV_INIT=/some/path/dbgsv.ini
 DBGSV_LOG=/some/path/dbgsv.log
  • In OpenOffice.org, press Shift+Ctrl+Alt+D, and then select TestTool in the Error list box.
  • In the TestTool, assertions are indicated by light blue. To manually reproduce an assertion, select MessageBox in the Error list box.

The TestTool Environment

The TestTool Environment contains the start scripts, the test scripts, and the libraries (include files) that are required to automatically test OpenOffice.org. The TestTool Environment is modular, so that a module exits for each application or area that you want to test in OpenOffice.org. To test a single OpenOffice.org application, such as Writer, you only need the application module and the global module.

module name / path name Description

application modules

dbaccess Database / Data source functionality in OpenOffice.org
spreadsheet Calc (spreadsheet)
chart2 Chart, the functionality of charts in a spreadsheet
graphics Impress (presentation application) and Draw (drawing application)
math Math (formula)
extensions Extensions functionalities
writer Writer (text document, HTML document, master document)
xml XML file format for all of the OpenOffice.org applications

general modules

framework General functionality for all applications (for example, galleries and extras)
global All general routines (for example, startup, tooling, declaration files)
tools Useful standalone applications (hid.lst perl script)

The following subcategories are defined for the TestTool Environment modules:


module name / path name Description
required Resource test: Activates all menu items and opens all dialogs of the tested application.
optional Performs a general functionality test for each feature in the tested application, including each menu item.
tools Includes libraries that contain the general subroutines that are required by all test scripts in the module or application.

These are only the defined name, you can also find other subcategories in the paths. Mostly the named of the directory mirror the tested area.

If you find a *.bas-file in one of these directories you are in a test-module. Those module should include the following directories/files:


module name / path name Description
*.bas Indicates executable test scripts. To run the script, open the *.bas file in TestTool, and then press F5 or choose Program - Start.
inc Includes the libraries and any associated files that are required for a test (included by use-method in the *.bas-file)
input Inputs the files that are required for the test.
tools Includes libraries that have general subroutines that are required by test scripts (*.bas). The libraries must be in the same directory as the test script.

global-Module

The global-directory is required for each test. The directory contains the main routines for running a test script, including the hid.lst, the declaration files that identify menu items, dialogs and controls in OpenOffice.org, and general tooling routines.


directory name description
hid Contains the hid.lst file.
input Contains common files that are required by the TestTool.
  • translated, office language dependent default filter names for each application (filters-directory)
  • translated, office language dependent OLE-object names (olenames-dir)
  • files for each graphic format that OpenOffice.org can read (graf_inp-dir)


sid Includes all SlotID declarations.
system Contains the routines to start a test script in these inc-files.
tools Contains general tooling routines in these inc-files (for example, declare.bas).
update Contains general resource-test routines in these files (options-dialog and autopilots)
win Contains all HelpID declarations.

Configuration file entries

The configuration file (UNIX: .testtoolrc, Win32: testtool.ini) contains several sections.The section name is surounded by '[', ']' and contains several entries like: EntryName=Value.

GUI Platform

Current= depends on the Platform.


UNIX Win32
Subsystem Current Subsystem Current
Solaris SPARC 01 Win 95 100
SCO UNIX 02 Win 98 395
Linux 03 Win NT 3 351
AIX 04 Win NT 4 400
Solaris x86 05 Win SE 410
Irix 06 Win ME 490
HP 07 Win 2000 500
FreeBSD 08 Win XP 501
Mac OS X 12 Win Server 2003 502
Linux PPC 13
NetBSD 14
Linux 64 bit 15
Linux SPARC 16
eComStation 17

Template:RU/documentation/signyear

Template:QaВottom