テストケース
Contents |
5. テストケース
各プロジェクトには、アプリケーションをテストするためのテストケースがあります。各テストケースは、回帰テストを自動化するために使用可能なアプリケーションの自動化されたワークフローです。「自動化の注意事項」 を参照してください。
テスト ケース オブジェクト
ページ
ページでは、アプリケーションのページを参照したり、アクションおよび検証のリストを表示したりすることができます。
各ページは GeneXus オブジェクトに関連付けることができます。GXtest Recorder で生成されたテストケースには、常に関連する GeneXus オブジェクトが含まれ、手動で実行する場合であっても、オブジェクトを選択する必要がありません。ただし、同じウィンドウに複数のフレームがある場合や、複数のウィンドウ (たとえばポップアップなど) がある場合、コマンドの実行時には、それらのテストケース内でオブジェクトを選択する必要があります。また、検証を実行している間、ページに定義されているオブジェクトに対応するページで CheckMainObject コマンドが実行されます。
エッジライン
各エッジラインはあるページから次のページへの移行を表します。各エッジラインには、必ず 1 つのイベントが含まれます。また、アクションおよび検証のリストを表示することもできます。
エッジラインの特徴は、特定の順序になることです。ノードに複数のエッジラインがある場合、テストケースの順序は各エッジラインの文字列順になります。次のテストケースの例を参照してください:
最初は Home ページに移動し、ClickLinkTable エッジラインに従いますが、2度目にはその同じページに戻り、ClickButton のエッジラインに従います。
テストケース (包含)
テスト ケース オブジェクトは別のテストケース内に埋め込むこと (モジュール化) ができます。テスト ケース モデルは再利用することができます。埋め込みテストケースの例については、次の 記事を参照してください。テストケースを別のテストケース内に埋め込む場合には、埋め込みテストケースを実行する回数を指定することができます。この値は、特定の番号にすることも、データプールから取得することもできます。データプールから値を取得した場合、たとえば、請求書の項目数などは、データプールに応じて異なります。
最も重要な点は、テストケースが失敗した場合に実行を停止するよう設定されているテストケースを含んでいる場合、テストケースのいずれかのイテレーション (反復実行) が失敗すると、含まれているその他のテストケースの実行も停止するということです。
条件分岐
A decision object allows you to follow two different workflows within an application based on certain conditions. For example, if our Test Case sends a notification to a client if he/she is from Uruguay, but sends nothing if the client is from another country, we can use a Decision to follow one workflow or another depending on where the client is from.
To see an example using Decision see Creating a Test Case with Bifurcation
Creating a Test Case
A Test Case can be created many ways. It can be done manually or by recording it with GXtest Recorder. GXtest Recorder can record a Test Case two ways: on-line and off-line.
Creating a Test Case manually
To create a Test Case manually, select Create New Test Case from the Test Case menu in the project panel.
This creates a Test Case that will remain open in the Models panel. In this new blank page you can begin to model the Test Case. To do so you must draw the workflow to be automated by creating the pages to be visited and connecting them with Edge Lines.
Once the workflow is ready, you must define the commands that will be run for each Edge Line and each Page.
See also list of available commands.
The Drag and Drop commands allow for easy construction of Test Cases in the Model editor, it is possible to simply drag and drop commands between different components (Edge Lines and Pages). This allows you to move or copy if you hold down the Control key. |
---|
Creating a Test Case with GXtest Recorder
The difference between On-Line and Off-Line is that the former uses GXtest Recorder together with GXtest Designer so that when you record a Test Case it remains in GXtest Designer ready to use. Whereas using the Off-Line method, GXtest Recorder works separately from GXtest designers and generates a file that later must be imported into GXtext Designer.
On-line Method
To record a Test Case using the On-Line method select Record New Test Case form the Test Cases menu.
This will open a window that allows you to enter a name for the Test Case and the URL where you want to begin to record. Once you click the Record button a new browser window will open where you can begin to perform the necessary actions. Once you have finished the workflow that you want ot automate simply close the browser window.
Off-line Method
As explained before the Off-Line method allows you to create a Test Case without having to have GXtest Designer installed. This will create a ZIP or XML (since v1.1.4) file that can be imported into GXtest Designer.
Once the ZIP/XML file is created you must create a new Test Case by selecting Import from the Test Cases menu (in the project Panel).
Then choose the ZIP/XML file created previously.
The advantage to this method is that it is not necessary to have GXtest Designer installed in order to automate, you only have to install the extension in Internet Explorer. This also makes it easier for any user to record a workflow for an application if they need technical support or if they are defining acceptance tests etc. For more details see GXtest Recorder User's Manual.
Test Case Validation
Before running a Test Case you should perform a validation. If a Test Case does not meet all the conditions to run it will not be run. Some of the possible causes for a Test Case to not be able to run are that there are no events on a certain Edge Line or that a connection is missing. To validate a Test Case press Shift+F6 or click the following button in GXtest:
Running a Test Case
In GXtest Designer there a several ways of running a Test Case which are described below.
Simple Running of a Test Case
You can run Test Case once by pressing Shift+F5 or clicking the button shown below
This will run the open Test Case one time.
Running a Test Case repeatedly
This allows you to run a Test Case as many times as you decide which allows you, for example, to use Data Pools. To repeatedly run a Test Case press Shift+F7 or click the button shown below:
Note: When you run N times, after each execution GXtest will close all open windows of the browser selected for execution.
Running a Test Case in an opened browser window
This allows you to run a Test Case in a browser window that is already open. To run a Test Case in an open browser press Ctrl+F5 or click the following button:
Note: If you are using Firefox browser (GXtest 1.1 or upper) this functionality can only be used with browser instances opened for GXtest or setted to start with-jssh.
Execution in FireFox (from version 1.1)
To run tests over Firefox you must install the Firefox Extension that can be found over GXtest installation folder : GXtest Designer\Firefox.
"C:\Program Files (x86)\Abstracta\GXtest Designer\Firefox\mozrepl-jssh.xpi" To find a way to install Firefox extensions you may want to take a look at: http://www.wikihow.com/Install-Firefox-Extensions
Para versiones de firefox inferior a 4: 2, 3, 3.5 and 3.6, you should download the plug-in jssh and install it. The plugin can be downloaded at the following links:
Then to tell GXtest Desginer to run using FireFox, change the project properties to the type of browser FireFox.
Note: We recommend disabling automatic updates and "Set as default" dialog in FireFox to avoid failures in the test cases due to this reason.
Important: while running a test case in any browser, GXtest is going to close automaticaly any popup like "do you want to activate autocomplete" or similar ones. |
---|
Advice for working with Test Cases
The following lists a couple pieces of advice concerning editing Test Cases.
- Copy and Paste commands with Drag&Drop: in GXtest its possible to move commands from one element to another by simply dragging them and dropping them. You can also copy commands by holding down the Ctrl key while dragging and dropping.
- Changing the order an element’s associated commands: click on the element in the commands panel and drag the commands placing them in the desired order.
Exporting and Importing a Test Case
This article shows the specific steps for importing and exporting a Test Case. If you would like more detailed information about XML generators and exporting Test Cases you can consult this article.
Sending and Recieving Test Cases between databases
As mentioned in the Login / Connections section, in GXtest it is possible to configure several connections. This allows:
- an easy exchange of Test Cases between databases
- exchange of Test Cases between workstations and the GXtest Manager database
It is important to keep in mind that the names of the projects that contain the Test Cases that are to be transferred ought to be the same. |
---|
Internally what happens is an export and then an import of the Test Cases into the corresponding databases. To send a Test Case follow these steps:
- Open GXtest using the connection for the original database
- Open the project
- Go to Test Cases > Send & Receive > Send To
- Select the Test Case that you want to send
- Choose the data that you want to send it to
- It will now show the export options (they include Data Pools, recurring Test Cases, etc.) Then click OK
- It will now show the results of the export. Close the results window when finished.
- It will now show the results of the import.
To receive a Test Case follow these steps:
- Open GXtest using the connection for the original database
- Open the project
- Go to Test Cases > Send & Receive > Receive From
- Choose the database that is going to receive the Test Case
- Then choose the Test Case that is going to be received and the options that you want.
- You will then see the results of the export and then the results of the import in the local database.