[英]How to write a pseudocode of an Selenium automation test?
我需要寫一個偽代碼,但我以前從未寫過偽代碼。 搜索一下,我找到了基本和簡單算法偽代碼示例,但我不知道編寫具有 Selenium 方法的偽代碼。
你有自動化測試的偽代碼示例嗎?
我想到了 Java 和 selenium,來自 cucumber 場景的自動化測試。 我只需要一個例子來指導我編寫我的偽代碼。
偽代碼以注釋和信息文本的形式編寫,僅用簡單的英語編寫。 就像編程語言一樣,它沒有任何語法,因此不能被編譯器編譯或解釋。
為了在java中編寫偽代碼,您可以按照以下步驟操作:
在Java中設計程序偽代碼時需要牢記的幾點:
if-then
、 for
、 while
、 cases
標准編程結構的方式與我們在編程中使用它的方式相同。Initialize c to zero.
Initialize n to a random number to check Armstrong.
Initialize temp to n.
Repeat steps until the value of n are greater than zero.
Find a reminder of n by using n%10.
Remove the last digit from the number by using n/10.
Find the thrice of the reminder and add it to c.
If temp == c
Print "Armstrong number"
else
Not an Armstrong number"
偽代碼是一種“偽”,因為它不一定使用現有方法進行操作。 只需對您的代碼使用常識即可
elements = Selenium.find(locator)
for each element in elements
do:
assert that element.text is not empty
od
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.