Tutorial: WebStore

Background

In this tutorial, we will guide you through steps to create the MBT model to test a simple set of web pages. The download package comes with a set of static dummy web pages we will use. The entry page is http://localhost:8888/DemoWebApp/ProductList.html. You may want to quickly browse the pages through to get familiar with them.


Start IDE

First make sure TestOptimal server is up running. We assume TestOptimal server is running on localhost:8888, if not adjust it accordingly. We also use %HOME%/ to indicate the root folder where TestOptimal is installed. The instruction is specific to IE, but you can easily translate it to other browser's.


Modeling & Automation Scripting

There are two components we need to create:

  1. MBT model that describes Web Store web application http://testoptimal.com/img/SimpleWebStore.png.
  2. mScript to drive Web Store web application web store mScrip.

The MBT model is built with TestOptimal browser while mScript is created with any XML editor or any text editor.


Test Generation

From the MBT model, the system can generate test sequences to test the application with the help of mScript which drives the web application with each transition (clicking buttons and links).


Steps By Step

There are 4 general steps in developing a model:

  1. Create Model - Click File/New Model to create a new model, use right-mouse context menu to create states and transitions connecting states. Use mouse to move states/transitions around. Make sure model has one initial state and at least one final states.
  2. Test / Validate Model| - execute the model and view the test sequences generated in MSC graph or in SeqTrace.
  3. Write MScript - output test case or test automation. Click on the state and transition to bring up the MScript for the state/transition triggers in MScript Editor. Use right mouse click to select MScript tags and control-space for code-assist.
  4. Execute Model - execute the model to generate the test cases into webpage or excel, or interact with web application.

Test Validation

What if we want to verify the result? You can accomplish it several ways by putting the verify script in one of the two mScript methods.

  • onentry method - onentry method is triggered (called) when entering the state (web page). This is the easiest if all you want to make sure is the right page is loaded but don't care it gest to that page.
  • use verify method - verify method is triggered (called) when the transition is completed. Use this function to verify the right page is loaded and right content is displayed as the result of the transition.

Either way, you can use assert script to identify the page being loaded and if it is the page that you are expecting. For example to make sure ProductList page is loaded, you would use:

  <assert value1="getValue(id=screenID)" op="eq" value2="ProductList"/>

Check out mScript for more details about mScript and functions.

Print/export
QR Code
QR Code webstore (generated for current page)