jinzihao.info Religion TEST COMPLETE TUTORIAL PDF

Test complete tutorial pdf

Thursday, May 16, 2019 admin Comments(0)

Create and run automated tests for desktop, web and mobile (Android and iOS) applications ( TestComplete 14 Documentation More Tutorials and Samples. Applied to: TestComplete PDF is a widespread platform-independent format of documents to share. Many applications use this format to export or import data . Quick Tour. Take a quick tour to learn about the main LoadUI features: Quick Tour. Click the image to enlarge it. Your First Load Test. Creating Your First Load .

Language: English, Spanish, French
Country: Andorra
Genre: Religion
Pages: 687
Published (Last): 02.07.2016
ISBN: 237-8-16679-675-3
ePub File Size: 27.81 MB
PDF File Size: 12.73 MB
Distribution: Free* [*Regsitration Required]
Downloads: 30803
Uploaded by: AILEEN

concepts, including keyword testing and test scripting, and contains a tutorial to help you get started with TestComplete. TestComplete Overview (PDF format). Affordable, Logical, Test Automation Platform. TestComplete is an open, functional automated testing environment with support for Web, mobile, desktop, and. Automated testing helps teams test faster, allows them to test substantially more code, improves test accuracy, and frees up QA engineers so they can focus on.

Both Project Suites and Projects provide a logical view of the files and folders that make up the project. Keys "Test" Call w4. See the example code snippet below. Enter "1" in to each of the edit boxes. Work with Web Pages 9 Summary Also, treat your test development like any other software development project and use the tools available to maintain the quality and integrity of your test code. For example, the following code example posts the title, author name, subject and other document information to the test log:.

Window "WorkerW", "", 1. Window "ReBarWindow32", "", 1. Window "ComboBoxEx32", "", 1. Window "ComboBox", "", 1. Window "Edit", "", 1. Use a Source Control Repository TestComplete is a development tool and as such the projects, scripts, data etc. If this is something you're already doing, skip ahead. If not, you should consider version control the next priority and work to get your test suites under version control. There are lots of options including some excellent Open Source projects which are freely available like Subversion, otherwise known as SVN.

While it's beyond the scope of this document to discuss the specific merits of source control it's a subject that shouldn't be ignored. In this section we'll discuss what a smoke test is and provide guidance as to how to construct the test in such a way as to maximize its effectiveness.

Creating a Smoke Test Probably the most important test you'll write is your smoke test, at least it should be. Typically, the goal of a smoke test is to verify that the latest build delivered to QA is either worth further consideration or DOA dead on arrival. A good smoke test should:.

TestComplete 14 Documentation

Your smoke test should serve as an model that embodies your "best practices" from which your QA team can draw from for their own tests. If you've never written a smoke test before, start small.

In the beginning simply get the smoke test to verify even a single piece of functionality consistently. Over time, work to increase its coverage but remain focused on the quality of the test.

It's unacceptable to have a smoke test that can't run consistently and without problems.

Executing your tests regularly Once your smoke test is written and under version control the next step is to automate its execution. The main benefit of a CI server is to reduce the amount of time it takes to execute your test automation as well as ensure that it executes against every build.

By setting up a CI server you can not only alleviate your QA engineers from having to manually execute their tests but you'll quickly identify tests that are unable to consistently run to completion and may require closer scrutiny. In addition, many CI servers include a means of publishing test results providing for great visibility into the automation efforts.

Before diving in and unleashing the full power of TestComplete be sure to organize your communication. Make communicating your results an important part of judging the success of your efforts. Also, treat your test development like any other software development project and use the tools available to maintain the quality and integrity of your test code. Remember the Goal Ultimately, the goal of test automation is to save time, money and improve quality.

Test automation can relieve you of the task of manually testing existing functionality allowing you to focus attention on areas not already covered by automation. However, that statement is only true as long as your existing test automation is working, being executed consistently and the results are clearly communicated to the people who need them.

In this section you will: Saving files, adding new units, recording, playing back, debugging, searching, formatting,etc The great thing about the toolbar is that it is customizable. So if you ever use a TestComplete functionality often and you don't see it on the toolbar, add it by right clicking on the toolbar and choose customize.

Click on the Commands tab and drag any functionality you desire to anywhere on the toolbar. Once you drag a command to the toolbar, the icon is persisted there permanently. The TestComplete IDE as you might expect consists of several pluggable windows that facilitate project management, code management, debugging, object browsing, main script and result logs workspaces.

The Project Explorer will allow you to see all projects in a suite and all the specific Project Items that are part of a specific Project. If you ever missed a Project Item from the Wizard at startup, you can always right click on a Project in the Project Explorer and choose Add New Item, where you will be presented with all TestComplete Project plug-ins to add to the project.

The Code Explorer on the other hand, is a different view into your code base that enables you to navigate easily between functions in large files, rename functions, delete functions, sort functions by name in the tree, etc The Object Browser is the most powerful part of TestComplete.

It is where all the brains behind the TestComplete muscle reside. When you click on the Object Browser Window in TestComplete, the engine monitors all running processes on your machine and extracts vital information about each process for display as you can see below. You can filter the kind of processes you need to inspect or eliminate a category of processes by right-clicking on the Object Tree below on the left and filter processes.

The Object Browser can also examine your system as a hardware unit and report on the CPU, CPU count, amount of memory RAM on the machine, Operation system is use, and other useful information, from a testing perspective. The Process Tree Pane enables you to view all currently running processes on the machine and its toolbar on top allows you to filter the processes from running application to system processes to chosen testapps applications in your TestComplete project.

By Right clicking anywhere in the Object Tree Pane, the popup menu appears with options to refresh the content of the tree, filter, terminate, copy to editor, sort and other useful functionality that we will discuss later in this chapter. Open Notepad from the Windows directory or System32, depending of the version of Windows you are running.

Notice that the process of Notepad is displaying three windows underneath the process and the Properties of the process itself are displayed on the right. The main Notepad window is actually the 3rd one down. To make sure that the main window of Notepad is the 3rd one underneath the process, right click on it and choose Highlight on the Screen. The Notepad application is brought to the front and the main window starts flashing with a red rectangle around the main window several times.

Notice in the Properties window that most of the properties have a blue color arrow next to them. One of the properties of that main window in Notepad is called "WndCaption" and it does not have the blue arrow next to it. That means it can be written to from the Object Browser. This property is actually the title of the window.

Push the CTRL key and click inside of the edit area of the property. Don't worry, you did not change Notepad forever: Now let's use the Finder tool to capture the Edit window in Notepad The white area only with no Notepad title or menus. Invoke the Object Properties dialog from the popup menu of the Object Tree.

Drag the Finder tool to the white area in Notepad until you see a red rectangle around the edit portion only. The Object Properties will automatically refresh and show all the properties TestComplete was able to see from the Window object in memory. The button pointed to by the number 1 above will allow you to highlight the window object in-place in the Object Tree Pane as part of the Object Browser. This is a very handy button when your application windows are numerous and have a deep hierarchy as is the case for Internet Explorer.

The button pointed to by number 2 above will allow you to highlight the object on the screen by flashing it several times, similar to step 3 above. From the previous sample with Notepad, you probably noticed that TestComplete recognized a lot of properties of the main Notepad window as well as the Edit window.

On the other hand, you probably also noticed that the Fields and Events tab were blank. Even the Methods tab had only methods pertaining to standard TestComplete functionality and actions.

Well, TestComplete will recognize objects and will go as deep as the application will allow it to. That means, it is based on how the application was built, developed or compiled as to what TestComplete will be able to see inside of it.

TestComplete 14 Documentation | TestComplete Documentation

TestComplete will be able to automatically see deeply inside. NET and Java application without any changes to the application just because of the nature of metadata generation of. NET and Java application which are easy to reflect. Reflection is the ability to retrieve internal objects, properties, methods and events. So these are always called White Box Applications. That would require compiling with Debug information enabled and the inclusion of some TestComplete files into the project to enable reflection of all program metadata.

While viewing the Object Browser, you will notice sometimes that a TestComplete icon will show next to a specific process. In this sample, I used Visual Studio to generate a very simple C based Windows application that adds two numbers together. The only line of code in this example is: ToInt32 TxtNumberOne. ToInt32 TxtNumberTwo.

Notice that TestComplete automatically figured out that we are dealing with a. NET methods, fields, events and properties associated with the application. We would be able to call it directly from the script and it will be visible to TestComplete via reflection.

One of the first features you will discover and love in the TestComplete Editor is the Code Completion feature. I am not sure how we used to write code before this feature was introduced in major development tools and in TestComplete. Instead of having prior knowledge of the objects you need to deal with in TestComplete or have access to the Help files, it is simple enough to let TestComplete do the job for you by entering the name of an object and placing a ".

That will invoke the Code Completion window with all properties, methods and events available for that object. Sometimes you even have the need to invoke the Code Completion window in the middle of a statement. Another great feature of the editor in TestComplete is the ability to place bookmarks in script units opened in the IDE and be able to jump between them by a simple keystroke.

In the figure above, please notice that the bookmarks are set on lines 5,15 and 18 see the yellow glyph in the gutter. Also, the Bookmarks window at the bottom of the editor will list all set bookmarks with their numbers, their unit names and their line numbers. To jump to a specific. Under Display, you have the choice to change the Text specifications, background colors and margin, gutter styles and capacity and also whether you want to show line numbers or not.

Another very useful feature of the editor in TestComplete is the ability to set Code Templates. Every Scripting language has it own templates.

Above you will see that I added a new Template called TCTraining that contains a function name "test" with a comment in it. The script itself can be anything that you expect to use a lot in your testing. Notice also the little pipe " " sign inside the brackets. The pipes indicates the position of the cursor in the code after the template has been inserted. Now lets go back to the editor and try to enter this template: The following code template helper will appear:.

The code is inserted in the script unit and the cursor is blinking right before the comment starts. The Debugger capabilities in the TestComplete's Editor are very helpful in finding script errors, flow problems and also to evaluate the values of local and global variables. The Breakpoints window in TestComplete is very easy to use. You can set breakpoints in your editor by clicking in the gutter next to the line you want to set a breakpoint on or by pressing F5 while the cursor is on that line.

In the Breakpoints window you can: That is better than deleting them and reentering them all over based on different debug sessions. If you are debugging a "For Loop" that goes on for iterations, knowing that it will fail some time after times, it would be wise to place a Pass Count of on the breakpoint instead of having to step over the breakpoint times. When the pass count is not known but a condition has to be met, the Condition property can be set e.

The Call Stack window is very helpful when your scripts get called one from the other in a long chain of execution. During a break in execution, the Call Stack window will show the order of execution for the. The figure below shows the Call Stack at a break in execution. Usually that is good information for pinpointing the offending procedure.

Unfortunately, in many cases "X" does not mark the spot like an Indiana Jones' movie, so the problem you are trying to figure out has already manifested itself way before the break in execution occurred.

These are tougher bugs to figure out. The Locals window is an easy and fast way to monitor the value of local variable inside of a specific function. Like in the figure below, we created 2 local variables, "myString" and "myNumber", and assigned specific values to both. To view their values, you only need to open the Locals window and they will be there as long as you are breaking inside of the function that contains them.

So how do you view values of variables that are not local to a function? That is the functionality of the Watch List. Notice in the screenshot below that the Global variable "myGlobal" did not show up in the locals window. This is correct, as the myGlobal variable is not a local of that function. To evaluate the myGlobal variable, go to the Watch List window and add a new item by right- clicking in the window. The output in the Watch List window will allow you to monitor the value of that variable during the life of the execution session.

You can also use the Evaluate command available from the debug menu item in the editor:. A Project Suite is a container of projects providing a mechanism to logically group related projects. To create a new project select File New Project The Create New Project dialog presents you with a number of pre-configured Project Templates that are geared towards specific types of testing.

The templates are:. For more details refer to the following section on the New Project Wizard. After creating a new project you can view all of its Project Items and sub items from the Project Explorer. In fact, removing a node from Project Explorer only removes it from the logical view presented by TestComplete and does not actually delete the item from disk which means you can easily add removed items back to a project.

Here is the above project viewed from within Windows Explorer:. Provide support for a specific type of testing. The child nodes that represent testing functionality of the Project Item or serve to organize its contents.

Provides a means of organizing Project Items and Project Item Elements within a Project When a project is initially created you have the opportunity to specify which Project Items you want included. You can add and remove Project Items at any point.

Adding them at the time a project is created is a matter of convenience. Both Project Suites and Projects provide a logical view of the files and folders that make up the project. When removing nodes from the Project Explorer you are only removing them from this logical view. The actual files and folders are not deleted from disk and may be added back to the project using the right-click context menu and selecting Add Existing Item Project Items Project Items make up the specific types of testing functionality or assist in performing various test operations.

TestComplete includes a large collection of Project Items covering a wide variety of test functionality. You can easily add and remove Project Items using the right-click menu on the Project node of the Project Explorer.

It's not crucial to know up front all of the necessary Project Items that your project will require as Project Items can be added or removed directly from the Project Explorer after the project has been created. Project Templates Initially, accepting the defaults on this dialog will be the preferred choice until your familiar enough with the available Project Items and can identify the ones you use most frequently at which point you can create a Project Template.

To define a new template select the Project Items you use most frequently and click the Save As Best Practice - Setting up a Custom Template If you're testing a Windows Application you may want to setup a Project Template that's geared towards that type of testing. In any testing organization it's important to establish standards like this to help maintain consistency across your testing organization. The following walk- through demonstrates how to create a custom Project Template you may find useful for testing Windows applications:.

At the bottom of the Items list click the Add button to add a specific Windows application to test against. In the Tested application edit box type the complete filename including path to the Windows application you wish to test or use the ellipsis Deleting a Project Template TestComplete 6.

You should be familiar with how to construct a Project Template for use across your organization for greater consistency and easy of use when creating new test projects. This item is not required but is highly recommended. RunAll command is used either from script or context menu. If the application is already running TestComplete will post a warning message in the Test Log. Parameters can be passed in Simple mode.

The stack trace of any exception that occurs in the application while the test s are being run will be recorded in the TestLog. This option requires debug information in the application under test. For example code coverage profiling could be used to see how much of the code is being tested by your automated tests.

We also looked at Win32 Tested Application project item in more detail. In this section you will:. Logs are stored in a directory as XML files. Log Tree This area will have a node for each Test Item level used to run the test. In the image above, for example, a project suite was run. The project suite is the top root node and each project is represented by the child of the project suite.

The statuses of child items in the tree bubble up to the parent items. In the screenshot above you can see that errors flagged in child level items the red X indicates the error status have bubbled up to the project suite node. Script Log This area contains messages coming from both TestComplete and the script code.

Tutorial test pdf complete

The are six different types of messages:. Message , will not cause the test to fail. Warning , not necessary a failure for the test but could be an indicator for why a test failed. Error , this indicates a failure for the test. Event , does not cause the test to fail. TestComplete generates an event for every mouse-click or keyboard entry in the test. Picture but TestComplete can generate as well Region Checkpoints.

File, will copy the file into the directory holding the log XML file and creates a hyperlink to the file. Link just creates a hyperlink to the file without copying the file. The script log area may have a hierarchical structure via creating and pushing log folders onto the log Log. AppendFolder, Log. PushLogFolder, Log. All messages by default go into the last pushed log folder i. Selecting Send via Email To preview what this file will look like, select View Results in IE from the context menu.

Most of the time, the tester is not interested in events unless there is a problem in the test run. TestComplete can eliminate events unless an error occurs. By adding Log. LockEvents to the script code, no events will be placed into the test log unless an error occurs.

By default the last 20 events are logged, but this can be changed by adding a parameter to the Log. LockEvents command. We learned how to email the test log and also how to reduce the size of the test log. In this section you will learn about:. For example:. Clearly there are numerous issues with this identifier, its long and awkward not to mention we have no clue about the purpose or identity of "Container1", "Container2" or "button1".

The issue here is that you still need to type:.

Process "Hello". TestComplete lets you create an Alias to represent this long string. If you create the Alias "btnSubmit", you only need to type:. The standard full name for this HTML element is: Page "http: Panel 0.

Link 1. This does not tell anyone reading the script what HTML element the code is working with. There are a. Use the finder tool to select the Products link and push the OK button.

If the NameMapping project item is not in the project, TestComplete will ask if you want to add the NameMapping project item. Click the OK button. If the parent objects have not already been mapped, TestComplete will require them to be mapped before mapping the selected item.

Aliases are best explained by example, we are going press the Skip button for both the Sys object On the second Panel object, TestComplete will say the it does not have enough information to make this panel unique in the NameMapping project Item. Although, TestComplete can work with non-unique objects, it is more reliable to have the object be unique.

Press the No button. Find the Parent property in the Available Properties and click the ellipse button. Press the Skip button. Since there is the possibility that a new link could be added before the Products link, the Selected Properties will be changed from the standard properties.

First, remove the Name property from Selected Properties, then add the innerText property. In script code, the Product link can be referred to by the following code: Link 1 or NameMapping. ProductLink or Aliases. In this way, Aliases allow you to ignore on-screen objects that were used for design but are not necessary to the test automation process. In the Name Mapping dialog, this is done by pressing the Highlight button.

Complete tutorial pdf test

In the NameMapping project item editor, highlighting is done by selecting Highlight on Screen from the context menu right-clicking. If that does not work, it will use the NameMapping project item. In manual coding you can use the Aliases as well.

If the Alias object is available in the Object Browser, then TestComplete will present all the properties and methods for that object. If the object is not available in the Object Browser, TestComplete will present a smaller subset of methods and properties.

This does increase the size of the NameMapping project item file but allows you to code without having the tested application open. The difference between Aliases and Name Mapping was explained. And we learned how to map an object from the screen. TestComplete supports five different types of Unit Testing:.

NET applications. Some of the unit test frameworks require that TestComplete know where the test runner application is located on the test machine. The information can be entered in the Options Dialog Tool Options from the main menu. NET unit testing framework available at http: When it is installed, it includes a sample unit test assembly. Add a Unit Testing Project Item to your project.

Click the ellipses button for the Assembly file name. Add the Assembly that holds the NUnit tests. Push the OK button. This will open the NUnit editor in TestComplete. Running a Unit Test 1. Create a new project 2. Add the "TestedApps" Project Item. Add a "Unit Testing" Project Item 6.

Select the "UnitTestingDemo" Process. Select the Mode of "Run selected tests only". Click the Load button. In this section you'll learn: TestComplete Manual Tests allow the person performing the test to indicate whether or not the test passed or failed and provide additional feedback in the event of a failure. From the main menu select File New New Project Create a Manual Test The step-by-step walk-through below demonstrates how to create a manual testing project, set up a manual test, add steps to the manual test and how to run the manual test.

Creating a Manual Testing Project 1. Under Test instructions type "Orders application must be running to complete this test". Enter the following Step Instructions: Select Order New Order Enter 2 in the Quantity Field c. Verify that the Total Field equals Running a Manual Test In this section we'll walk through running a manual test and logging mock failures along the way.

Scripting and Manual Testing In this section we'll illustrate using Scripts with manual tests and cover how to hook Manual test events. Using Manual Tests from Script Code 1. Create a new TestComplete project. Double click Unit1 under the Scripts node in the Project Explorer to open the code editor. VBScript is used in this example and your code may vary if you're using another scripting language.

In the Main routine, add a blank line under the "Enter Code Here" comment 4. Press Ctrl-Space to display the Code Completion window 5. Select TestedApps from the list.

Once the list appears you can begin typing to select the item from the list. With the cursor at the end of TestedApps type a period ". Type another period and select Run 8. Press Return to add a new blank line below TestedApps. Run 9. Press Ctrl-Space to display the Code Completion window Select ManualTest1 Type ". Press Return to add a new line below ManualTest1.

Start Select TestedApps Type a period ". This example will build upon the Manual Test created in the previous step. With the previous project still open expand the Events node in the Project Explorer 2.

Double click the GeneralEvents node. Double click the OnBeforeStep event to add the event to your test 5. Click on the OnBeforeStep item then click the New button.

In your Unit1 script file add a new blank like below the function declaration and type 'BuiltIn. ShowMessage "Hi from script" '. We also illustrated how you can interact with manual tests from scripts.

TestComplete has several options that allow you to control how recording is performed. You should see the following options:. Clicking the More Details button will expand the toolbar such that it displays Parent and Object name data for the item underneath the mouse cursor. Starting a Recording To start a recording you must have a project loaded. You can load an existing project or start a new project.

Once you have a project loaded there are two ways to begin a new recording:. The Add Text to Script toolbar button allows you to insert either script or comments into the routine that's currently being recorded. Clicking this button displays the Add Text to Script dialog:. Notice there is a checkbox at the bottom that allows you to indicate that the text is to be inserted as a comment.

There is also a Pick Object The recording toolbar has several buttons see circled buttons below that allow you to control the type of recording being performed. TestComplete allows you to pause in the middle of a recording by clicking on the Pause button. Pausing a test allows you to manipulate the application under test or change the environment without recording any of those actions into the script. To resume a paused test click the Start Recording button. To stop a recording click the Stop button.

Clicking the Stop button will close the Recording toolbar and restore the TestComplete main window leaving you in the Code Editor on the newly recorded script. Recording a basic script 1.

Create a new project and project suite using the General Purpose Test Project template:. Once Windows Notepad starts type "this is a test from TestComplete".

We discussed the functionality available on the toolbar including how to record various types of activity. For example, if TestComplete would record every mouse and keyboard operation automatically during each recording session, we would have ended up with thousands of lines of script identifying the mouse movement coordinates and clicks, while in most cases these are not necessary.

On the other hand, if you are trying to Paint in a program like MS Paint or trigger a Hover event inside of Internet Explorer or FireFox, it is very much necessary that the recorder brings in the valuable mouse and keyboard coordinates, clicks and keystrokes. If you forget, no worries.

You will still be able to add it to the project after the fact using the Add New Item menu of the project in the Project Explorer. When you start a recording session in TestComplete, you are presented with the recording tool bar shown below. On the recording tool bar are two buttons that enable Low Level Procedure recording:. For a smoother playback and easier implementation between different resolutions on the screen, we recommend the "Window Coordinates" button to be used.

Start a new Project 2. Start recording 5. Choose the Low Level Procedure - window coordinates button from the recording toolbar. Drag the button from step 5 above to the MS Paint main window of the application until you see a red line around the entire MS Paint window.

Getting Started With TestComplete

The Create Project item dialog below will appear. Upon completion of your masterpiece, stop the recorder from the TestComplete recording toolbar.

Notice that TestComplete did not record any of the clicks on the MS Paint application, but added one line of code to function Test1 to execute the collection of mouse movements and clicks collected during the recorded session. TestComplete collected all the mouse movement and clicks from the recorded session into an LLCollection item in the project called "MSPaintCollection" see above.

The nice thing about this workspace area is that you are able to modify 1 or a bunch of these records at will. You can reduce the amount of time between operations, delete meaningless mouse movements that are not needed or event change the mouse coordinates on the screen after the fact.

You can now try to playback the recording by running the routine. What happened? Are you surprised? Well, you probably saw the mouse moving on top of the TestComplete Editor in a pattern exactly as you expected would happen in MS Paint. That is because nothing caused the MS Paint application to come to the front or be activated. To fix that issue for your script, always activate the window that needs to be focused and top-most before running your low level procedures.

Activate ; LLCollection1. Execute Sys. We also fixed a situation where the testing environment did not work as first expected. Alternatively, you can exclude header and footnote lines from the extracting.

The sample project that is attached to this article contains examples that demonstrate how to do that.

To extract an image from a PDF file, you need to obtain the image data and then save it to some file on your disk. To get the total number of images on a page, use the length property of the image array. You can use this property to iterate through all the images on a page:. For example, the command This method automatically adds the extension to the file name depending on the object type. To save an image in another format, use the getRGBImage method of the image object.

It returns the bufferedImage object that you can save to the file with an arbitrary extension. For instance, the following code example saves an image to a. Sometimes especially when you compare PDF files , you may want not only to get the document text, but also to check if it is positioned properly.

To perform this task, you can convert a page to an image and then use this image in your comparison tasks. You can save it to a file then. For instance, the following function gets the PDPage object by using the getPage function, saves it as an image and returns the Pucture object that corresponds to the image:.

Complete pdf test tutorial

This method returns the PDDocumentInformation object, whose methods and properties allow you to retrieve the metadata. For example, the following code example posts the title, author name, subject and other document information to the test log:.

When you need to find the string within a PDF file, you must get text from the PDF file and use the aqString methods to find the desired string in the text.

For instance, the following example finds a string in a PDF file:. Compare method to compare it with some baseline text value. The following code snippet shows you how to do this:. Compare method or another suitable method. For this purpose, save the desired picture to the temporary file and then compare the saved image with another one.

For instance, the following function compares a picture from the PDF file with the sample. Note that in this example, we use the getPage and getImage functions that were written earlier:. For example, to check text of the document, you can obtain lists of paragraphs and compare each of them. The following code snippet shows you how to do it. We do not use the getParagraphText function here on purpose, because it divides text at every call. This function divides the text only once for each page, and then we get the list of paragraphs and iterate through it:.

Note that even documents were generated by the same application. For example, they can be different because of the different creation dates in the header. To exclude such regions from comparison, use the image mask. The following code snippet shows how you can compare two PDF files in this example, we use the convert PageToPicture unctions that were written earlier:.

In this article, we imply that your PDF document is not encrypted. If your PDF file is encrypted, the specified test scripts will not function until you decrypt the file. In any case, you will have to specify the password that was used to encrypt the document. This article describes basic approaches for retrieving and comparing data of PDF documents with TestComplete. We hope it helps you get started working with PDF documents in your tests.

We would suggest that you explore the PDFBox library documentation to find objects, methods and properties that will help you perform more sophisticated test operations.

If you have not used TestComplete yet, download and try it for free. English Deutsch. Buy Contact Blog Community Login. Buy Contact Blog Community Log in. Files TestComplete sample project Author: SmartBear Software Applied to: TestComplete 10 PDF is a widespread platform-independent format of documents to share.

This is a Java library that provides objects, methods and properties for retrieving and changing PDF file data. You can find more information on the library on its official web site -- https: Thank you! Applies to TestComplete Recommended for novice users, regardless of your tested application type. Creating Your First Test Step-by-step tutorials for testing desktop, web, and mobile applications. To get started with TestComplete, select the needed type of a tested application in the table below: Web Applications that run in web browsers including browsers embedded into desktop applications.

More Tutorials Advanced tutorials that teach you various testing techniques.