I need to write a pseudocode, but I've never write a pseudocode before. Searching about I have finded basic and simples algorithms pseudocode examples, but I don't have any idea to write a pseudocode that have Selenium methods.
Do you have an example of pseudocode for an automation test?
I have in my mind Java and selenium, automation tests from cucumber scenarios. I need just a example to guide me to write my pseudocode.
CodePudding user response:
Pseudocode
Pseudocode is written in the form of annotations and informational text that is written in plain English only. Just like programming languages, it doesn't have any syntax, so it cannot be compiled or interpreted by the compiler.
Ways to write Pseudocode in Java
In order to write the Pseudocode in java, you can follow the steps below:
- You need to maintain the arrangement of the sequence of the tasks and, based on that, write the pseudocode.
- The pseudocode starts with the statement that establishes the aim or goal.
Points which we need to keep in mind while designing the pseudocode of a program in Java:
- You should have to use the appropriate naming convention. By doing that, it is very easy to understand the pseudocode. So, the naming should be simple and distinct.
- You should have to use the appropriate sentence casings. For methods, we use the CamelCase, for constants, we use the upper case, and for variables, we use the lower case.
- The pseudocode should not be abstract, and the thing which is going to happen in the actual code should be elaborated.
- We use the
if-then
,for
,while
,cases
standard programming structures in the same way as we use it in programming. - All the sections of the pseudocode should be completed, finite and clear to understand.
- The pseudocode should be as simple as it can be understood by a layman having no sufficient knowledge of technical terms.
- Ensure that the pseudocode isn't written in a complete programmatic manner.
Sample Pseudocode
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"
CodePudding user response:
Pseudo code is a "pseudo" because it has not necessarily operate with existing methods. Just use the common sense for you code like
elements = Selenium.find(locator)
for each element in elements
do:
assert that element.text is not empty
od