katalon installation, recording, executing simple Web scripts

Keywords: Java Mobile Firefox Windows

katalon installation, recording, executing simple Web scripts

_Xiaobian is not talented. The article written yesterday was not saved and lost!Rewrite one today.Don't talk too much, just get right!
Catalog

  • Download katalon
  • Register katalon
  • Recording scripts
  • Edit script
  • Run script
  • Analysis results

_This catalog is ugly, but it shows what I've done!

Download katalon

  • Open the katalon website address: https://www.katalon.com/
  • Click one of the red boxes.
  • katalon will let you sign up for an account to download, activate, and free!
    • Enter your name, mailbox, login password!You can register now.

  • Enter the download interface after successful registration.
    • Select your system, download the installation package for your system Click Download
    • I downloaded Windwos 64bit, other systems should download according to their own system!

  • No matter which one you download, download it first and then, make sure you don't download the wrong system!
  • This is what happens when the download is complete!
    • Unzip: Unzip to any path, the path to unzip is the installation path of the program, all unzipped paths must be carefully selected!


_Yes, yes, there is no installer, no installation path selected, no next step, the software will run directly!

Activate katalon

  • Double-click katalon.exe to enter the registration interface!
    • Enter the mailbox you just registered and your login password will be activated!
  • After successful activation, enter the welcome screen, if you are interested, you can click and see!
  • Closing the activation interface has a guide interface that teaches you how to use the software.
    • I have written the content of this interface at the back, so you can see him or mine!
      ,

_Going here, I declare that the browsers supported by katalon need to be installed in the default path, otherwise the following exception will occur

Test Cases/Demo_test_case_No FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to open browser with url: ''
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
	at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:60)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)
	at Demo_test_case_No.run(Demo_test_case_No:19)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:342)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:333)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:312)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:304)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:238)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1555653938286.run(TempTestCase1555653938286.groovy:21)
Caused by: org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: WIN10
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
System info: host: '5MRZNF2U2EMZWS9', ip: '192.168.1.199', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'

By the way, mention katalon-supported browsers_

Browsers

Browsers Windows macOS Note
Internet Explorer 9, 10, 11 N/A Use of IE requires special configuration
Microsoft Edge Current N/A R Use Edge Browser Refer to Edge Page
Firefox 56+ If you are using Firefox 57+, download katalon 5.1+
Google Chrome 58+
Safari 5.1+ 9,10,11

Mobile

Installation Windows macOS Appium Native App support? Hybrid App support?(*) Mobile Browser support?
Android 6.x, 7.x 6.x, 7.x 1.6, 1.7, 1.8 YES NO YES
iOS Not Available 9, 10, 11, 12** 1.6, 1.7, 1.8 YES NO YES

_Unfortunately, windows does not support IOS system at this time!

Recording scripts

  • A new project should be created before scripting
    • Path File_New_Project
  • Click Project s to see the following interface
Label Effect
name Name of project
Type Project type
API/Web Service: Server Interface Test
Web:web project project
Mobile: Mobile side testing
Generic: Basic Testing
project Project Template
Repository URL Template Path
Location Save Location
Description Item Description

Enter data, click OK!

  • Wait a few milliseconds for a welcome screen!Regardless of it, just click the button in the red circle, the button of this recording script!

  • Start recording script
    • Enter the web address to be tested
    • Select the browser to use

_Selected the browser, the browser will open automatically, the mouse operation on the above will appear red box, representing that a script is being recorded, I simply record a script!
Content: Visit the website, register an account with an invalid equivalent user name, and check if the prompt is correct!

_Server is the download address I picked up from Copy in LR:
Links: https://pan.baidu.com/s/1B-u2PCeNjWi0vh4d67xAVg
_Extraction Code: 8wog

  • Click OK after recording is complete

  • Prompt you what the objects you save are!

_Red means an object that already exists, so don't worry, just choose Replace existing objects, or milliseconds anyway!

  • Hit OK and prompt you to create a Test Case

    |Label|Role|
    |–|--|
    |name|The name of the test case|
    |Description|Use Case Description|
    |tag|The use case belongs to that tag|

_Click OK and your first test case is created.See figure_below


  

Edit script

_Scripts are available, but the recorded scripts are not smart enough to edit with yourself!
Simply edit, parameterize, wait time, assert,!

  • Original script
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys
// Above is the recording script added automatically, regardless of it!

// Open Browser
WebUI.openBrowser('')

// Open Civil Service
WebUI.navigateToUrl('http://127.0.0.1:1080/WebTours/')

// Click the Register button
WebUI.click(findTestObject('Page_Web Tours/b_sign up now'))

// enter one user name
WebUI.setText(findTestObject('Page_Web Tours/input_Username _username'), 'jack_1')

// Input password
WebUI.setEncryptedText(findTestObject('Page_Web Tours/input_Password _password'), 'tzH6RvlfSTg=')

// Confirm Password
WebUI.setEncryptedText(findTestObject('Page_Web Tours/input_Confirm _passwordConfirm'), 'tzH6RvlfSTg=')

// Click the Register button
WebUI.click(findTestObject('Page_Web Tours/input_CityStateZip _register'))

// Clicking on the prompt * will cause an error because the div element cannot be clicked directly!
WebUI.click(findTestObject('Page_Web Tours/font_Your username is invalid  Please re-enter it'))
  • Parameterized script
    • Click Variables_Add
No. name Type Default Value Description
number Variable Name data type Default value describe

_Explanations on parameterization will follow...

  • waiting time
    katalon has a lot of waiting time. I'll follow up with details...
// Set Wait Time
WebUI.waitForPageLoad(2000)
/**
Wait for page load time, hermit wait!It is within 2 seconds that the page is loaded and the rest of the time is not waiting!
Follow up if the page is not loaded after two seconds!
*/
  • Assertion
// Just give him a conditional expression after the assert keyword that returns True or False!
assert err_desc == "Your username is invalid. Please re-enter it.1"
  • Edited script
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys

// Above is the recording script added automatically, regardless of it!
// Open Browser
WebUI.openBrowser('')

// Open Civil Service
WebUI.navigateToUrl('http://127.0.0.1:1080/WebTours/')

// Click the Register button
WebUI.click(findTestObject('Page_Web Tours/b_sign up now'))

// Enter username to add parameterization
WebUI.setText(findTestObject('Page_Web Tours/input_Username _username'), Username)

// Input password
WebUI.setText(findTestObject('Page_Web Tours/input_Password _password'), password)

// Confirm Password
WebUI.setText(findTestObject('Page_Web Tours/input_Confirm _passwordConfirm'), RePassword)

// Click the Register button
WebUI.click(findTestObject('Page_Web Tours/input_CityStateZip _register'))

// Set Wait Time
WebUI.waitForPageLoad(2000)

// Clicking on the prompt * will cause an error because the div element cannot be clicked directly!
err_desc = WebUI.getText(findTestObject('Page_Web Tours/font_Your username is invalid  Please re-enter it'))

// Output data in console
println(err_desc)

// Just give him a conditional expression after the assert keyword that returns True or False!
assert err_desc == "Your username is invalid. Please re-enter it."

// Close Browser
WebUI.closeBrowser()

Run script

When executed properly, it is impossible to have only one script, which requires multiple scripts to execute together. I copied that script several times. No s failed the assertion, OK succeeded the assertion.

  • Create a new Test Suites
    • The path is right-clicked on Test Suites New Test Suites

      _Enter a name, description

  • Add test Case
    Add the test cases you want to run!
  • Test Suites Page

_Pre-function, post-function follow-up...

  • Run Test Suites

_Open Test Suites and click Run!

Analysis results

_The system automatically saves the results under Reports

  • Analyze run results
    _records the success of that use case and the failure of that use case.System information, running logs, etc.Detailed follow-up...

summary

_Do this and believe that you have a preliminary understanding of katalon!

I will write some other ways of using it according to the official website later!Include trampled pits!

_This article is written according to the katalon website, if the similarity is pure coincidence, it is not plagiarism!!!

Posted by henry gayman on Sun, 05 May 2019 14:56:38 -0700