ComponentOne has been one of the leading providers of controls for application developers for almost a decade now. On the basis of such characteristics, these controls provide a large number of tasks that can be performed by integrating all these controls into one composite Business Application. These business applications can be complex or simple depending on user's requirements.  A user would always like to ensure that the correct output is being generated by the Business Applications. However, manually testing it can be a tedious task, but automation can help in easing the job.

The beauty of ComponentOne controls is that they can be captured well through Microsoft's CodedUI Automation testing tool.  With its help, steps can be recorded and played back whenever required. Assertions placed on these steps or the output generated will then help in testing.

CodedUI comes integrated with premium and ultimate editions of VS2010. It generates a UIMap object that is specific to our test and represents the windows, controls, parameters and assertions that are in the UI or those we created during the test recording.

Here, I would like to demonstrate its usability with C1Report control as an example.

Combining C1Report controls like C1PrintDocument, C1PrintPreviewControl, C1Report in one application enables users to perform various tasks like previewing C1Documents/Report Files, exporting to various file formats, printing the reports rendered using different printers, setting of Page Layouts while printing, etc.

In this blog I will automate a simple scenario- 'Opening of C1dx file in C1PrintPreviewControl and then save the file into c1dx file formats'.

We will start by creating a sample project and placing C1PrintPreviewControl on the Form. TA test project that contains the script for the scenario mentioned above will be included. Test Project is one of the templates offered by VS2010.

See, before recording the script, one must have a clear understanding of the steps required for automation of any scenario. In this case we have to:

  • Click on the 'File Open Dialog' which displays a "Open File" dialog.

  • Click  on the "Save" button to save the document in .c1dx file format.

All these steps will be recorded using the CodedUI Tool integrated with VS2010 and played back as we require.

Running the script

Follow the steps below to run the script:

  • Run the attached sample project in Non-debug mode (Press Ctrl F5).

  • Open Test List Editor.

  • Check the script i.e. 'OpenSaveFileScript'.

  • Select Run Check Script from Context menu.

Please see the below attached image to locate "Test List Editor" and the script inside it.

Finally, the set of steps recorded in the script will be executed.
Once it completes, a 'Testc1dx.c1dx' attached to the sample automatically opens up and gets rendered in C1PrintPreviewControl. Thereafter it is saved in 'c1dx' format in the 'ExportedFiles' folder.

The script can also be extended for exporting the document rendered in other file formats as well. All we need to do is record these steps accurately. In the script we used in our example above, we also included a simple assertion defining - if the "Open File" Dialog exists when clicking "Open File Dialog" button. Similar assertions can be applied to capture images of the control and used for image comparison to ensure a correct output in different scenarios.

Conclusively, I would like to emphazize yet again that since C1 Controls are effectively compatible with CodedUI, automating them using CodedUI becomes a plain vanilla task. Here I presented a very simple scenario with C1Report, but other C1Controls can also be used extensively with CodedUI Tool in a similar manner.


  • Make sure that the attached sample  is run-on a system where C1Report control is licensed, or else the scripts might fail.

  • Ensure that the folder (exportedFiles) is empty while running the scripts.

  • Do not move your mouse while the scripts are running.

Download C1Report Sample