当前位置:网站首页>Automatic test tool katalon (WEB) test operation instructions

Automatic test tool katalon (WEB) test operation instructions

2022-07-06 23:45:00 tcc374254426

Catalog

Catalog

1. Katalon brief introduction

2. install Katalon

2.1. register

2.2. download

2.3. start-up

3. Create a test project

4. Create test cases

5. Record a use case

6. Run test cases

7. Verify in test cases

8. Create a test suite

9. Create a test suite collection

10. View the test suite execution results

10.1. adopt Result see

10.2. adopt Reports see

11. Two views

11.1. Manual View

11.2. Script View

12. Common built-in keywords

12.1. Open Browser

12.2. Close Browser

12.3. Click

12.4. Set Text

12.5. Set Encrypted Text

12.6. Upload File

12.7. Verify Element Text

12.8. Switch To Frame

12.9. Switch To Default Content

12.10. Switch To Window Title

13. Recording function

13.1. Record a new test case

13.2. Use existing test case records

13.3. Verify when recording UI Elements

14. Monitoring function

14.1. Use Spy Web Capturing objects

15. Handle WebDrivers

15.1. End WebDrivers

15.2. to update WebDrivers

16. Variable type

16.1. General variables

16.2. Test case variables

16.3. Global variables

17. Call between use cases

18. conditional

19. Fault handling

19.1. Stop on Failure

19.2. Continue on Failure

19.3. Optional

19.4. Rewrite fault handling behavior

20. Custom keywords

20.1. Create custom keywords

20.2. Use custom keywords

21. Send test report email

22. common problem

22.1. The browser won't open ,openBrowser Execution failure

22.2. How to use F12 debugging xpath

22.3. How to use F12 obtain xpath

  1. Katalon brief introduction

Katalon Studio It's a Web、API、 Integrated test automation solution for mobile and desktop , Designed for beginners and expert testers .

This article is only for Web Test and make operation instructions .

  1. install Katalon
    1. register

Use Katalon Studio You need to register an account , Follow the prompts to register

https://www.katalon.com/sign-up/

    1. download

Download address :

https://www.katalon.com/download/

    1. start-up

double-click katalon.exe file

 

  1. Create a test project

File > New > Project , Enter the project name 、 Type selection Web、 Select project location

 

After creation , The local directory of the project is as follows :

 

  1. Create test cases

Right click Test Cases > New > Test Case, Enter the use case name

 

  1. Record a use case

Click on Record Web, Enter Baidu address , Click on Record

 

 

Katalon start-up chrome browser , And open Baidu home page , Then perform the following steps manually :

1、 Enter in the search box “ Zhongke Meiluo ”

2、 Click on “ use Baidu Search ”

3、 Click on “ Anhui Zhongke Meiluo Information Technology Co., Ltd ”, Open the company's official website

4、 Click on the official website of Meiluo in turn “ Product center ”,“ Information Center ”

The above actions are Katalon Record , Click on Expand You can view the script details

 

 

Click on the top right corner , End script recording , Click on Save Script Save script , Pop up the page object pop-up , It shows the page objects used in the script , Click on OK, Preservation

 

 

Saved script and page object , Here's the picture :

 

On the left side Object Repository, You can rename the page object , Support Chinese , Make use cases more readable and maintainable , The renamed page object and script are as follows :

 

  1. Run test cases

Click on Run case , The default browser is chrome, Click the drop-down arrow , You can choose another browser to execute , for example Firefox、IE etc.

 

 

Use Record Web Use cases for function recording , There are some mistakes , Need to modify and adjust , for example , When the page jumps to the official website of Meiluo ,switchToWindowTitle The title of was recorded as “ use Baidu Search , You will know ”, Need to be modified to “ Anhui Zhongke Meiluo Information Technology Co., Ltd ”, After modification , The use case can be executed successfully .

 

  1. Verify in test cases

Add a validation script to the test case , Verify that the page is displayed correctly , for example , Verify the product center page , There is “ Smart government cloud service platform ”

 

Katalon Studio Provides a rich set of validation keywords to verify the page

 

  1. Create a test suite

Right click on the Test Suites > New > Test Suite

Test Suite You can try again when the configuration fails 、 Email sending or data-driven binding :

 

  1. Create a test suite collection

Right click on the Test Suites > New > Test Suite Collection

Test Suite Collection yes Test Suite Set , adopt Execute Button execution

 

  1. View the test suite execution results
    1. adopt Result see

Click on Test Suite perhaps Test Suite Collection Of Result page , adopt Result You can view the latest test results

 

 

    1. adopt Reports see

Click on the left side of the Reports, According to the execution time , Find the corresponding report , Export to HTML

 

HTML The report can show the execution results and steps in detail

 

 

  1. Two views
    1. Manual View

The test case

 

Variable

 

    1. Script View

The test case

 

Variable

 

  1. Common built-in keywords
    1. Open Browser

Open the browser and navigate to the specified URL. If URL It's empty , Then just open the browser . Generally used in the first step of test cases

Open the browser and navigate to “ https://www.baidu.com/ ”

WebUI.openBrowser('https://www.baidu.com/')

Only open the browser

WebUI.openBrowser('')

  1. Close Browser

Close all browser windows , It is generally used in the last step of the test case

 

  1. Click

Click on the given element

 

  1. Set Text

Set the value of the input field , It clears the previous value of the input field

 

  1. Set Encrypted Text

Set the encrypted text into the input field , for example , When entering the login password , You can use the encrypted password to enter , Prevent password leaks .

To encrypt the original text , have access to Help > Encrypt Text, Copy and paste the encrypted text .

 

 

 

 

  1. Upload File

Upload files to type="file" Of input Input box , The path parameter passed in here is the absolute path of the file , We can customize keywords , Splice the relative path of the file with the current path of the system , Make the test script easy to transfer

 

 

  1. Verify Element Text

Verify the text of the element

  1. Switch To Frame

Switch the current context to iframe

Switch iframe It can also be in the Parent iframe To configure , After the configuration , No need to use it every time Switch To Frame Switch

 

katalon In built-in keywords , It's automatic iframe Handoff

 

  1. Switch To Default Content

After processing some framework elements , Switch back to the default window

  1. Switch To Window Title

Switch to the window with the given title

  1. Recording function
    1. Record a new test case

1、 single click Web Record , open Web Recorder

 

 

2、 Input Web Application's URL, for example ,https://www.baidu.com/

3、 Select a browser to start recording , Recommended “New Browsers” Type of Chrome or Firefox 

 

New Browsers: Start a new browser

Active Browsers: Reuse existing browsers

choice Active Browsers when , Installation will be prompted Katalon Recorder Browser plug-in , Click on Install extension Installation , If it's already installed , Just click Continue recording

 

The installed plug-in is shown in the figure below :

 

4、 The browser instance will start automatically , And record the manual operation steps , Click on , The end of the recording

 

    1. Use existing test case records

You can continue recording based on existing use cases , You don't need to record all the actions again

1、 Open any existing test cases

2、 single click Web Record , open Web Recorder, choice Yes

 

3、 Click on Expand an

 

4、 Click on Execute use cases ,katalon The browser starts , And perform the existing steps ( Pay attention to Close Browser Delete , In case the browser closes , Unable to continue recording ), After performing the steps , Just continue recording

 

 

  1. If you don't want to perform the recorded steps , Click on , Then click the pause button , After suspension , Operate the page to the place where you want to continue recording , Then click the Continue button to record
  2. Save script ,Katalon Studio It will automatically detect Objects Repository Similar existing objects in , And ask you to take further measures to optimize Object Repository.

 

 

 

Select append script as needed , Or overwrite the script

 

    1. Verify when recording UI Elements

Katalon Support in use Chrome、Edge( be based on Chromium) and Firefox When recording , Add mouse over and verification steps by right clicking on elements in the page

Web Recorder There is also the prompt

 

 

  1. Monitoring function
    1. Use Spy Web Capturing objects

1、 Click on Spy Web

 

2、 Show Object Spy Dialog box

 

3、 Click on Start  Start capturing objects , Click on Start The pull-down arrow behind , The following browser options appear

 

 

New Browsers: Start a new browser

Active Browsers: Reuse existing browsers

choice Active Browsers when , Installation will be prompted Katalon Recorder Browser plug-in , Click on Install extension Installation , If it's already installed , Just click Continue with object spy

 

4、 The selected browser will launch , And navigate to the designated website

5、 Hover the mouse cursor over the page object to capture ,Web The object will be highlighted with a red border  , The relevant  xpath  Information

 

6、 Using shortcut keys To capture objects , The object will be highlighted in a green border  

 

 

7、 The captured object appears in  Object Spy  In the dialog box

 

8、 single click  Save Add these objects to Object Repository

9、 Check in the left pane to save to Katalon Studio Objects in the ,Object Repository Displayed in the right pane , Select a destination folder or create a new folder , Click on OK

 

10、 The captured object is added to Object Repository in

 

  1. Handle WebDrivers
    1. End WebDrivers

In the toolbar , choice Tools > Web > Terminate running WebDrivers

 

You can also set after the end of each use case , End drivers

 

    1. to update WebDrivers

In the toolbar , choice Tools > Update WebDrivers. Select browser from the drop-down list

 

  1. Variable type
    1. General variables

 

    1. Test case variables

At the end of the test case Variables  Tab , Add the variables of the test case

 

 

Test case variables can be used to parameterize the test case or call the test case with different inputs

1、 Parametric test cases : When executing use cases in a data-driven way

for example , Data files :

 

The test case , Defining variables :

 

Test Suite Set data binding in :

 

2、 Call the test case with different inputs

for example , When making use case calls , Want to pass parameters to use cases , Called party , You need to set variables to accept parameters

Called party :

 

The caller :

 

    1. Global variables

Global variables can be accessed anywhere in the project , Global variables are defined in Execution Profile In file

 

Execution Profile It helps to cover many different environments , for example , You can configure the dev、test、pre、pro Of various environments Profile file

 

Use of global variables :GlobalVariable.xxx

 

 

  1. Call between use cases

1、 Open a test case , Select from the command toolbar  Call Test Case

 

2、 stay Test Case Browser In the dialog box , Select the test case to call

3、 One Call Test Case The steps of are added to the use case , If the called test case sets variables Variables Words , It will be on the right Input Column pass in variable

 

  1. conditional

Use scenario example , The login use case, as a public example, will be called by other use cases , When called , I don't want to execute openBrowser and closeBrowser The operation of , When the login case runs independently , To perform openBrowser and closeBrowser

1、 Select from the command toolbar Decision-making Statements/If Statement

 

2、 stay Input Column input judgment conditions

 

The following is shown in the use case :

 

3、If Sentence use Manual The view looks cumbersome , use Script View is better understood

 

 

  1. Fault handling

Troubleshooting allows the user to decide Katalon Studio Whether to continue running when an error occurs during execution

at present ,Katalon Studio The following troubleshooting options are supported

    1. Stop on Failure

If anything goes wrong ,Katalon Studio take stop it perform

Steps with errors will have Failure state

Default fault handling behavior

    1. Continue on Failure

Despite any errors in the execution ,Katalon Studio Will still continue

Steps with errors will have Failure state

    1. Optional

Despite any errors in the execution ,Katalon Studio Will still continue

Steps with errors will have Warning state

Optional Function can be used for logical judgment , for example , Add the use case of annual inspection information , Annual inspection information cannot be added repeatedly , You need to judge whether the annual inspection information already exists , When it already exists , To delete

 

    1. Rewrite fault handling behavior

The fault handling behavior of each test step can be rewritten in the test case

Manual View : Right click the step you want to change the troubleshooting behavior

 

Script view : about Katalon Studio All built-in keywords in , add to FailureHandling As the last parameter

 

  1. Custom keywords

In addition to built-in keywords , You can also define custom keywords to extend Katalon Studio The function of . After creation , You can use custom keywords when implementing test cases , Just like other built-in keywords

    1. Create custom keywords

    1. Use custom keywords

Manual View : Open the test case , Select... From the toolbar Custom Keyword

 

In the newly added test step , Select the required custom keywords

 

Script View : Use CustomKeywords Class to access all custom keywords

 

Input CustomKeywords. A code prompt will appear

 

  1. Send test report email

The free version only supports sending Test Suite Test report email ,Test Suite Collection You need to charge for your mail

1、 stay Project/Settings/Email Configure global email settings in

 

  1. stay Test Suite Configure recipients in ,Test Suite After execution, you will receive the test report email

 

3、 You can also configure recipients in global email settings , Recipients of global emails will receive Katalon All reports of

 

4、 After the execution , You will receive the following email

 

  1. common problem
  1. The browser won't open ,openBrowser Execution failure

 

 

resolvent :

  1. Execution time , Click the drop-down arrow , Select the corresponding browser New Session

 

  1. Close all browser windows
  2. to update WebDriver
  1. How to use F12 debugging xpath

When the object locator is damaged , We often need to check xpath The correctness of the , If you use the given xpath Cannot query object , Or query multiple objects , on xpath Modified , The method is as follows

Open the page , Press F12 Enter developer tools

Method 1 : adopt Elements

stay Elements Next , Press Ctrl+F, A search box appears at the bottom of the page

 

Input xpath, View results

 

Method 2 : adopt Console

stay Console Next , Use $x() Function to query

 

  1. How to use F12 obtain xpath

Open the page , Press F12 Enter developer tools

Click the leftmost arrow , Locate the page object

 

 

After locating the object , The right choice Copy > Copy XPath

 

原网站

版权声明
本文为[tcc374254426]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207061609559427.html

随机推荐