## Smoke Test - XML Editor

Last updated: June 25, 2001

This Smoke Test primarily focuses on the RTP portion of the XML Editior, which is the Source page of the XML Editor. It also performs some integration testing. For example, it tests synchronization between the Design and Source pages of the XML Editor, as well as with the Outline and Properties views. It also verifies that files created through the XML File wizard and references to the XML Catalog are supported as expected.

NOTE: XML files are case-sensitive so be sure that things appear exactly as noted.

## Setup

Starting Clean

- Delete any existing workbench
- Start Eclipse

Open an XML Perspective

- Select the Open Perspective toolbar button in the upper left
- Select Other...
- Select XML
- Verify the following views appear in the XML perspective: The location of the Outline and Navigator views are reversed from the Resource and Web perspectives. Do we want to try to be consistent across the perspectives? Also, I opened defect 177664 to enable easy access to the Properties view from within the XML perspective. If this view isn't included in the Perspective because its use is limited, then recommend we at least provide a Show or Hide Properties View toolbar button (similar to the buttons that Page Designer provides).

Project Creation and File Imports

- Create a Project, XMLTest2
- Import the following files into this project:
  - PurchaseOrder.xsd
  - Invoice.dtd
  - JobDesc.xml
  - Wireless.xml
  - gotchaTCBeans.set
  - ATS.dtd
  - any others?

## Create/Open/Edit test cases

Create an XML File from scratch

- Select the Create a new XML file toolbar button.
- Verify the Create a XML File wizard appears and the Finish button is disabled. DEFECT: 177660 - XML File wizard: disable Finish button on the first page.
- Accept the default to Create a new XML file
- Go to the Next page
  - Select XMLTest2 as the folder
  - Specify a File name of fromScratch
  - Select Finish
- Verify the following:
  - fromScratch.xml appears in the Navigator view.
  - fromScratch.xml is open to the Design page of the XML Editor and has focus.
  - the Design tab appears before the Source tab in the XML Editor.
  - the Design and Source page show no content.
  - the Outline and Properties views show nothing.
- Switch to the Source page. Verify the cursor appears at the beginning of the file.
- Right mouse button 2 and verify a popup menu appears.
- Hit Ctrl+Space. Verify the content assist proposal list appears.
- Select <?xml version="1.0" encoding="UTF-8"?>
- Verify <?xml version="1.0" encoding="UTF-8"?> is inserted and appears syntax highlighted and an entry appears for it in the Outline view.
- Position the cursor within the XML declaration and verify version and encoding appear in the Properties view. This used to work, but now it's not working. Opened defect 177662 - XML declaration attributes not appearing in Properties view. If we decide to not treat version and encoding as attributes, then this step should be removed.
- Continue to the next section.

Identify a local DTD (verifies a DTD is immediately recognized; in the past, you had to close and reopen the Workbench)

- Type the following after the XML declaration in fromScratch.xml: <!DOCTYPE Invoice SYSTEM "Invoice.dtd">. The text should be syntax highlighted as you type and you should see an entry get added to the Outline view.
- Hit Enter to create a new line after the DOCTYPE declaration.
- Hit Ctrl+Space.Verify only Invoice and comment appear in the proposal list. (NOTE: Invoice is the root element)
- Hit Enter to accept Invoice as a selection. Verify the Invoice start and end tags are inserted into the Source and the cursor appears between them. An element entry should appear for Invoice in the Outline view. (NOTE: XML is case-sensitive so be sure you see Invoice and not invoice everywhere).
- Hit Ctrl+Space. Verify the following appears in the proposal list (in the order shown): Item is appearing before Header. The default is not to sort the list alphabetically. That means the list should be sorted based on the order in which the child tags are defined in the element definition for Invoice in the DTD. In other words, users should see child tags listed according to their sequencing order in the DTD, which the DTD Editor shows. Violating the sequencing order causes an XML file to become not valid. DEFECT: 177668
  - Header
  - Item
  - comment
- Hit Enter to accept Header as a selection.
- Verify the Source now looks like the following and the cursor appears before invoiceNumber:
- Verify Header appears nested under Invoice in the Outline view.
- Close this file, and respond Yes when prompted to save the changes.
- Reopen the file and verify the changes were saved.
- Close the file. Verify no save changes prompt appears.

Create an XML File from an imported DTD

- Select the File->New->XML File.
- Verify the Create a XML File wizard appears.
- Select to Create a new XML file from a DTD file
- Go to the Next page
  - Select XMLTest2 as the folder
  - Specify a File name of fromLocalDTD
  - Go to the Next page
- Select the Import File button
  - Use the Browse button to find testcase.dtd
  - Select XMLTest2 as the folder. Would be nice if this were already filled in. Open a defect.
  - Select Finish to close the Import File wizard
- Expand XMLtest2 and then select testcase.dtd. Was expecting to see the imported file selected in the Workbench files list, but it wasn't. Open a defect.
- Go to the Next page.
- Select testcase as the Root Element.
- Accept the default to Create required content only.
- Verify testcase.dtd appears as the System Id.
- Select Finish. Verify fromLocalDTD.xml appears in the XML Editor. Verify the Source page looks like the following:
- Verify the Outline view and the formatting indentation reflect the proper element/tag hierarchy. Here's what the Outline view should look like:
- Verify selection synchronization between the Design page, Source page, Outline view, and Properties view.
  - From the Source page, click within the header start tag. Verify header is selected in the Outline view and in the Design page and that the following properties and property values appear in the Properties view:

    Property | Value
    category | webtool
    number | idvalue0
    state |
    subCategory | Accessability
    subSubCategory |

  - From the Outline view, select the testBucket tag. Verify testBucket is selected in the Design page and the current marker in the lefthand margin of the Source page indicates the range of the testBucket tag. The Properties view should show a property of type with a value of ComponentTest.
- Verify edit synchronization between the Design page, Source page, and Properties view (focus here is on adding attributes and attribute values).
  - From the Source page, use content assist to insert an attribute and attribute value for the header start tag.
    - Position the cursor after the category attribute in the header start tag.
    - Type space and then hit prompt for content assist.
    - Verify only state and subSubCategory appear in the proposal list (content assist is smart enough not to list any attributes that already exist in the start tag since attributes can only appear once. Cool!).
    - Select state.
    - Verify state="UnderConstruction" is inserted in the Source page (content assist automatically inserts any default values. Cool!). Verify the Design page and Properties view reflect this change.
  - From the Properties view, update the state attribute value to "UnderReview" (a pulldown list of values should be available). Verify the change is reflected in the Source and Design pages.
  - From the Design page, add an attribute and attribute value to the header tag.
    - Bring up the popup menu for the header tag.
    - Select Add Attribute->subSubCategory from the popup menu (it's smart enough to know which attributes haven't been specified yet ... like content assist. Cool!).
    - Type in a value of Keyboard support.
    - Verify the change is reflected in the Source page and Properties view

Open an XML File that references a remote DTD

- Open the Wireless.xml file.
- Verify it looks like the following in the Source page:
- Verify the Outline view and the formatting indentation reflect the proper element/tag hierarchy. Here's what the Outline view should look like:
- Verify content assist Defect 176379 (in verify state, but still not working).

- Create a new line after the wml start tag.
- Prompt for content assist on the new line.
- Verify the following appear as proposals (in the order shown):
  - head
  - template
  - card
- Create a new line after the wml start tag.
- Type a space before the ending delimiter on the card start tag.
- Prompt for content assist
- Verify the following appear as proposals (not necessarily in the order shown).
  - title
  - newcontext
  - ordered
  - xml:lang
  - onenterbackward
  - ontimer
  - id
  - class
- Position the cursor within the method attribute value in the go start tag.
- Prompt for content assist
- Verify post and get appear as proposals.

- Verify selection synchronization between the Design page, Source page, Outline view, and Properties view.
  - From the Source page, click within the card start tag. Verify card is selected in the Outline view and in the Design page and that the content assist proposals listed above for the card tag appear as properties in the Properties view. No values should appear for these properties.
  - From the Outline view, select the postfield tag. Verify postfield is selected in the Design page and the current marker in the lefthand margin of the Source page indicates the range of the postfield tag. The Properties view should show the following properties, none of which should have a value:
    - name
    - value
    - id
    - class
- Verify edit synchronization between the Design page, Source page, Outline view, and Properties view (focus here is on adding elements/tags).
  - From the Source page, copy and paste the card tag.
    - Position the cursor in the card start tag.
    - Notice the range of the card tag in the lefthand margin area.
    - Copy this range of lines using the Edit->Copy pulldown menu selection.
    - Paste after the card end tag using Ctrl+V.
    - Verify the appropriate lines were pasted n the Source page. Verify the Design page, Outline view, and the Properties view reflect this change.
  - From the Design page, add another card tag.
    - Bring up the popup menu for the wml tag.
    - Select Add Child->card from the popup menu.
    - Verify the Source page, Outline view, and the Properties view reflect this change. NOTE: it should have generated out the same thing as the original card tag, with the exception that a method attribute should not exist in the go start tag.

Create and Validate an XML File from a schema

(these steps are taken from the 'Design' smoke test, except the Source Page is the focus)

- Right mouse button 2 on the PurchaseOrder.xsd and select Create XML File.
- Accept the default file names.
- In the Select Root Element page, choose purchaseOrder as root element.
- Choose Create required and optional content to create a minimal document.
- Enter po as the namespace prefix.
- On Finish, a PurchaseOrder.xml is created and the XML Editor is opened. (Select Source Page if not already there.)
- Run Validate. The PurchaseOrder.xml should be invalid.
- Double click on the error message. It should be positioned to the line in error, i.e. the partNum attribute. It is invalid because the value is not set to match the XML schema pattern facet "d3-[A-Z]{2}" (3 digits followed by 2 characters).
- In the Source View, locate the partNum attribute under element item. Enter the value 333-AB.
- Run Validate. The PurchaseOrder.xml document should now be valid.

- Place the cursor after the <items> tag and besure "item" is listed in the content assist list.
- Rename the purchaseOrder.xsd to, say, purchaseOrderHOLD.xsd
- Verify that content assist still gives you "item" as above.
- Now select the "Reload Dependancies" button.
- Verify that now content assist no longer lists any items other that the macro "comment".
- Repeat making purchaseOrder.xsd workable again.

Open an XML File for a shipped DTD catalog entry
[put in optional section .. this isn't a customer scenerio]
To verify that shipped DTDs are working:

- Use a web project with a standard web.xml file in it. Be sure there is no web-app_2_2.dtd file in the directory. In the web.xml file itself, mangle the web-app_2_2.dtd filename in the system id a little, such as change it to xeb-app_2_2.dtd to be sure it can't be found via the normal http method (This isn't really necessary for the funtion to work, its just to be sure only the catalog function is in effect).
- Go to the preferences page, and open the XML Catalog. Verify there is an entry for -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN.
- Once all the prep work is done (files deleted, text modified), you should exit and restart Eclipse to be sure you have a fresh start.
- Open the web.xml file and be sure that content assist works for that file. For example, right after the end of the </display-name> tag, ctrl-space should provide a long list of elements, starting with servlet, servlet-mapping, etc. This indicates the shipped DTD function is working and configured correctly (at least for the web.xml file).

Create an XML File from a new DTD catalog entry

The following comes directly from the 'Design' Smoke Test: XML Catalog for XML Schema

- Run Validate on PurchaseOrder.xml to make sure it is valid
- Create a new project, XMLTest2
- Move the PurchaseOrder.xsd into XMLTest2.
- Run Validate on PurchaseOrder.xml. You will notice that it is no longer valid. The error message should give you a hint that the file PurchaseOrder.xsd can no longer be found.
- Open the Window->Preferences and select the XML Catalog.
- Enter the pair Id = PurchaseOrder.xsd Uri = f:\eclipse\XMLTest2\PurchaseOrder.xsd
Or alternatively, you can use a relative path to the install directory of the workbench as follows:
Id = PurchaseOrder.xsd Uri = .\XMLTest2\PurchaseOrder.xsd
- Click on the Reload button to reload the catalog settings.
- Run Validate. The PurchaseOrder.xml document should now be valid.

## Save/Validate test cases

Saving an XML File
(NOTE: the Identify a local DTD test case tests the save prompt on a file close.)

- If any files are open, select File->Close All (or Ctrl+Shift+F4) to close them.
- Open any xml file in the XMLTest2 project.
- Verify the following (no-changes-made condition):
  - File->Save is disabled.
  - File->Save All is disabled.
  - File->Save As is enabled.
  - the Save toolbar button (a diskette) is disabled.
  - the Save As toolbar button is enabled.
  - Save is disabled on the Source popup menu. Would be nice if the Design popup menu also had a Save selection. Open a suggestion defect.
  - no * appears in the file tab.
- Make a change in the Source page.
- Verify the following (changes-made condition):
  - File->Save is enabled.
  - File->Save All is enabled
  - the Save toolbar button (a diskette) is enabled.
  - Save is enabled on the Source popup menu.
  - a * appears in the file tab.
- Hit Ctrl+S.
- Verify the no-changes-made conditions apply.
- Make a change in the Design page.
- Verify the changes-made conditions apply.
- File->Save All.
- Verify the no-changes-made conditions apply.
- Make a change in the Properties view.
- Verify the changes-made conditions apply.
- Select Save from the Source popup menu.
- Verify the no-changes-made conditions apply.
- Close and then reopen the file.
- Verify the changes that were made in the previous steps appear in the Design and Source pages.

Saving an XML File across multiple perspectives (optional)

- Open any xml file in the XMLTest2 project.
- Make a change to the file.
- Open another XML Perspective by:
  - selecting Perspective->Open->Other...
  - while holding down the Shift key, select XML.
- Verify another XML Perspective button appears in the lefthand side of the Workbench to represent this second perspective.
- Open the same xml file as in the first step above.
- Verify the changes-made conditions apply in both XML Perspectives and verify that the changes made to the file in the first perspective appear in the same file in the second perspective. The * never appears in the file tab of the second perspective even when make changes to the file in the second perspective. Talk to David.
- Make some changes to the file in the second perspective.
- Verify these changes appear in the same file in the first perspective.
- Close the file in the second perspective and respond Yes to the save changes prompt.
- Verify the no-changes-made condition applies in the first perspective.

Validating a non well formed XML File (no DTD/Schema)
(NOTE: it's important that the following be typed in. This test case tries to cover some of the more common errors that render an XML file as not being well-formed. It is not intended to verify that all possible errors are being detected and gracefully handled. )

- Select the Create a new XML file toolbar button.
- Accept the default to Create a new XML file
- Go to the Next page
  - Select XMLTest2 as the folder
  - Specify a File name of NonWellFormed
  - Select Finish
- Prompt for content assist.
- Select <?xml version="1.0" encoding="UTF-8"?>.
- Create a new line after the XML declaration.
- Prompt for content assist.
- Select comment.
- Embed more than 2 consecutive dashes in the comment. (NOTE: more than 2 consecutive dashes can not be embedded within a comment)
- Type in the remaining lines as shown below: (I can't show the lines until defect 177755 is fixed ... until then, here's the type of things that cause a document to not be well-formed):
  - create a start and end tag that don't match in their case sensitivity (e.g., <tag> and </Tag>).
  - create a start and end tag where the start tag contains an attribute value that is not enclosed in quotes. (NOTE: this is permitted in HTML, but not XML)
  - create tags that are not properly nested. (NOTE: a child tag must be completed before its parent tag)
  - create a start tag without a corresonding end tag. (NOTE: all start tags must have a corresponding end tag unless the tag is an empty tag, in which case the shorthand version can be used (<shortTag/>)).
  - do not provide an attribute value (="value"). (NOTE: this is permitted in HTML for those attributes that have only one value, but it's not valid in XML)
  - define an attribute more than once in a start tag.
- Save the file.
- Verify errors are listed in the Tasks view for the above violations and that error markers appear on the appropriate lines in the Source page. I'm not sure how the Design page handles any of these violations and what will appear in the Outline and Properties view. Talk to Craig and David.
- Reopen the file and verify everything was saved.

Validate an XML File based on a DTD

- Open fromScratch.xml.
- Delete a character from one of the start tags (mistyping a tag is not uncommon).
- Prompt for content assist within the bad tag. Verify a message appears in the status area of the Workbench indicating that the bad tag is an unknown tag.
- Select the Validate toolbar button.
- Verify an error appears in the Tasks view and an error marker appears in the Source page to flag the invalid tag.
- Select Edit->Undo from the Source page.
- Verify the bad tag error no longer appears in the Tasks view.
- Remove the Header end tag from the Source page.
- Save the file.
- Verify an error appears in the Tasks view indicating that the Header end tag is missing
- Close the file, responding Yes to the save changes prompt.
- Double-click on the error in the Tasks view, and verify fromScratch.xml opens to the appropriate line in the Source page of the XML Editor.
- Here's some other violations that can be attempted:
  - Specify a bad attribute.
  - Specify a bad attribute value.
  - Specify child tags out of sequencing order
  - Violate the occurrence indicator for a tag (e.g., if the DTD shows ?, then only 0 or 1 occurrences of the tag is permitted).
- Save the file.
- Verify errors are listed in the Tasks view for the above violations and that error markers appear on the appropriate lines in the Source page. I'm not sure how the Design page handles any of these violations and what will appear in the Outline and Properties view. Talk to Craig and David.
- Reopen the file and verify everything was saved.

## Source Specific test cases (optional)

Using the Auto Completion Content Assist Preference

- Open a any XML file that has enough tags to provide syntax hightlighting.
- While that file is left open, go to the Preferences page, select XML Editor, then Source Styles.
- On that page, use the mouse to "select" a tag name. The tag name is not literally selected, but when you click on an element in the example text, the list above it will display the type of element it is, and what its current colors are.
- For "tag name", select the bold check box. Then press Apply, and you should see the change take effect in your active editor.
- Select "Defaults" and make sure the tag names are set back to not bold.

Double-Clicking Within the Source
(NOTE: if you continue to double-click at a given cursor position, the selection area will continue to expand. When the maximum region area has been reached, the next double-click will cause the original selection. So, the selections will wrap/cycle. Cool!).

- Open JobDesc.xml.
- Double-clicking within tag content:
  - Double-click within Middleware on line 7.
  - Verify Middleware is selected in the Source and Design pages and BusType is selected in the Outline view. Not sure what the Properties view is supposed to show. It goes blank. See defect 177753. Also, Middleware wasn't selected in the Design page as had expected. The Design page only seems to stay in sync at the element/tag level like the Outline view. Talk to Craig about this.
  - Double-click again at the same cursor position.
  - Verify Application and Middleware Software is selected in the Source and Design pages and BusType remains to be the only thing selected in the Outline view.
  - Double-clicking again will cause cycling back to the original selection.
- Double-clicking within a tag name:
  - Double-click within HowToApply on line 61.
  - Verify HowToApply is selected in the Source page, Design page, and Outline view. class, distribute, id, and name should appear in the Properties view. Only distribute should show a value.
  - Double-click again at the same cursor position.
  - Verify the whole HowToApply start tag (including its delimiters) is selected in the Source page. HowToApply should remain selected in the Design page and Outline view. HowToApply and all descendents become selected in the Outline view (defect 177752). Also, the Properties view shows no properties (defect 177753).
  - Double-clicking again will cause cycling back to the original selection.
- Double-clicking within an attribute name:
  - Type Ctrl+End to position the cursor at the end of the file.
  - Double-click within distribute on line 61. Verify distribute is selected in the Source page and HowToApply is selected in the Design page and Outline view. class, distribute, id, and name should appear in the Properties view. Only distribute should show a value.
  - Double-click at the same cursor position. Verify distribute="internal" is selected in the Source. Nothing should change in the Design page or views.
  - Double-click at the same cursor position. Verify the whole HowToApply start tag is selected in the Source page (including its delimiters). Nothing should change in the Design page or views.HowToApply and all descendents become selected in the Outline view (defect 177752). Also, the Properties view shows no properties (defect 177753).
  - Double-clicking again will cause cycling back to the original selection.
- Double-clicking within an attribute value:
  - Type Ctrl+Home to position the cursor at the beginning of the file.
  - Scroll down such that line 61 is visible.
  - Double-click within internal on line 61. Verify internal is selected in the Source page and HowToApply is selected in the Design page and Outline view. class, distribute, id, and name should appear in the Properties view. Only distribute should show a value.
  - Double-click at the same cursor position. Verify "internal" is selected in the Source. Nothing should change in the Design page or views.
  - Double-click at the same cursor position. Verify distribute="internal" is selected in the Source. Nothing should change in the Design page or views.
  - Double-click at the same cursor position. Verify the whole HowToApply start tag is selected in the Source page (including its delimiters). Nothing should change in the Design page or views. HowToApply and all descendents become selected in the Outline view (defect 177752). Also, the Properties view shows no properties (defect 177753).
  - Double-clicking again will cause cycling back to the original selection.

Formatting a File Created by Different Editors

- Import the JobPosting.dtd and JobDesc.xml
- Open the JobDesc.xml. Check the source for indentation to see if it preserves the white space from the original document.
- The orignal document uses spaces and tabs, so the formatting will appear a little wrong. By using the right/left arrows, verify that some space is spaces and some space is tab characters.
- Use 'format document' to be sure it formats.
- The default is to format with spaces ... verify only spaces remain in file, not tab charactes. (Just a little movement with the arrow keys should suffice.
- Go to the preference page to change the format settings for the XML Editor to use the tab character instead of 4 spaces. While there, verify that the dialog will not allow other values to be intered except "whitespace" ...'\t's and blanks.
- Format the document again and be sure this time tab characters were used.

## Other test cases

Associate the XML Editor to a new file type

- Window->Preferences.
- Expand Workbench.
- Select File Editors.
- Select the Add button to add a new file type.
- Specify a file type of *.set and then close the Add dialog.
- Verify *.set is selected in the list of file types.
- Select the Add button to associate the XML Editor to the new file type.
- Select XML Editor from the list of editors. Verify it appears with its own special icon. Close the dialog. NOTE: waiting to hear back from OTI on how can prevent 2 XML Editor entries from appearing in the list.
- Verify XML Editor appears as the default editor now for the *.set file type.
- Open gotchaTCBeans.set from the Navigator view. Verify it opens to the XML Editor.

THE END!