Test Cafe Implementation in DANA — Part 2 : Class Name and Naming Convention

Thursina Andini
DANA Product & Tech
3 min readOct 29, 2020

Most computer system uses name to identify element such as class, method or variable. This name is important piece of metadata. After we implement some applications, we found the issue related finding selector. It became difficult and painful to find the selector without unique identifier.

Below is example of complicated selectors:

Selectors Example

Because of this, we must standardise the rule name in order to make it easier to find the selector. In this case, we can’t use “id” for naming convention because Developers will need a lot of time for refactoring. So, we should use “class name” for naming convention.

What is Naming Convention?

A naming convention is a rule to follow as we decide to name the identifiers such as class, method, variable, package, etc. By using standard naming convention, we can make our code easier to read for other people. Readability in code program is very important. The following below is benefit that can be obtained by adopting naming convention.

  • To figure out what the source code meaning in short time
  • To enhance clarity in cases of potential ambiguity
  • To help formalise expectations and promote consistency within a development team
  • To provide meaningful data to be used in project handovers which require submission of program source code and all relevant documentation
  • And to provide better understanding in case of code reuse after a long interval of time

So, let’s find out the standardisation naming convention for class name that we want to apply for DANA Engineering team!

H5 Naming Convention for Class Name

H5 Class Name

Based on that naming convention above, we can use the rules that we applied for DANA web.

For example, we want to find selector “button”. How can we find that?

  • First simply, choose element that you want to check
  • Type from search textbox “btn-”
  • Click enter
  • The selector “button” is showed “btn-download-page”

It’s very easy to find when we have standard rule for each selector.

DANA Web

Conclusion

Using standard naming convention is very helpful and easier for SDET (Software Developer Engineer in Test) to find the selector. For example, we want to find some selectors like button, form, image, etc. Besides that, we should collaborate with Developers to define the naming convention together. So, hopefully this standardisation can be used for whole engineering team.

--

--