Skip to content

CFP‐ Tutorial Robocon 2024

Kelby Stine edited this page Oct 17, 2023 · 8 revisions

Goal

Get Attendees start the discussion on code quality in their respective teams.

Message

Seniority is no requirement to start thinking and talking about code quality

Context

We all want to write maintainable TA code

Robotframework provides a lot of freedom which is awesome, but also provides for many ways to write bad code

Many TA-engineers come from a background of functional testing and do not have a background in software development.

Story

Code Quality is maintained at different levels:

  • Ordering of your code (architecture)

  • Where should your code be written

  • ( How does it link our intend to the technique )

  • Actual written code (conventions)

  • How should your code be written

We focus on the second. (should we even mention the first?)

  1. How do we decide to write our code:
  • Syntax - it has to adhere to RF syntax or it won't even run
  1. Preference - the writer of the code will have some preferences on how to write things based on experience.
  • usually implicit

  • Code Conventions - Shared conventions within the team, saved in a place everyone can read up on them.

  1. How do we adhere to our code conventions
  • Code reviews

  • Linters like Robocop

  • bonus: Robocop in CI pipeline

Tutorial Part

Create some conventions (guided group activity)

  • Line length

  • Variable naming (local lowercase, other capitals)

  • one or two more (like the line continuation on arguments)

resources:

  • style guide

  • robocop ruleset

Check a bad example against these rules (guided group activity / demo)

code review

Configure RoboCop (demo)

configure the rules in robocop

use robocop to verify

Reporting (demo)

Run Robocop Report

Configure Robotidy (demo)

Configure robotidy to transform

apply robotidy

Write new code (demo)

Write two new keywords adhering to the code guide lines.

Using Robocop hints

Using robotidy to transform for us

Create a report to see if quality has degraded or not

Conclusion

To start working on code quality, you have to decide on conventions. To adhere to them there are tools that can be configured to help you. It still needs human interaction and strictness in the team to adhere to it.

Manana:

Abstract (draft)

How to organise your Robot Framework project? How to structure resource files? How to deal with very long lines? How to ...? Come and join this tutorial to learn where to find answers on these questions.

At the workshop, we also welcome discussions on what well-written

Robot Framework code means, and will share a little secret how to become a contributor to the first (comprehensive) Style Guide for Robot Framework. Everyone is welcome, from beginners to experts.

Here, we should probably advice to bring their laptops too 💻 (edited)

Taking into account Guido's list:

Description (draft)

Workshop will start with a general introduction, followed by a warm-up discussion in groups about the code quality, specifically in the context of Robot Framework (~5+15 minutes minutes).

Next, tools and resources to assist code writing will be introduced: Style Guide, robocop, robotidy (~30 minutes)

Optional break (10 minutes)

After the break, guided hands-on sessions will be held. The first hands-on session will include an exercise to convert a messy Robot Framework code into a clean code with the help of the Style Guide, robocop and robotidy.

(25 minutes)

Reflection - opinions regarding the recommendations in the Style Guide, and default rules in the robocop/robotidy.

(10 minutes)

The last part of the workshop will be dedicated to coming up with own conventions:

  • Configuring settings in robocop and robotidy (demo ~10 minutes)

  • Contributing to common Style Guide and using it as a common reference (~10 minutes).

Conclusion (~5 minutes) (edited)

Clone this wiki locally