Cloud Computing - Git, GitHub, Software Testing and GitHub Actions

GIT & GITHUB BASICS

Versioning

Versioning tools help track different streams of work using a file storing system. This system leverages storage, registers changes, prioritizes them, and facilitates parallelization for efficiency.

GIT & GITHUB

  • Git: A software versioning tool that acts as a tree structure to track, synchronize, and monitor code (and files in general).
  • GitHub: A centralized web/desktop application providing user-friendly access to the Git tool via a UI.

Authentication & Cloning

  • Cloning a repo creates a reference to a virtual space where content can be altered to suit needs.
  • Can be done in GitHub via HTTPS (user+pass/token) or SSH (configuring a key-pair).
  • HTTPS:
    • Requires authentication for every interaction with the repo.
    • Easily set up.
  • SSH:
    • Implies setting up a connection.
    • Does not require further authentication.

Most Frequent Commands

  • git pull: Accesses the content of either a local or remote Git repo.
  • git commit: Creates a symbolic link (a pointer) to a specific state of work obtained via a specific set of changes.
  • git push: Saves and uploads the latest committed changes to the current repo.

Other Commands

  • checkout: Switch between branches (or create new ones).
  • add: Track latest changes.
  • rm: Remove content/item.
  • merge: Merge contents of different branches (workspaces).
  • status: Current state of a branch (commits, tracked/untracked files, etc.).

Branches

  • Branches are the most useful feature for parallelization.
  • Allow simultaneous work with no interference (same task, different subtasks).
  • Allow for segregation of duties (features).
  • Allow for progressive environmental promotion (dev acc/uat prod).

Merging

  • Merging is a way of combining changes between branches, starting at the last common ancestor and ending at the latest commit.
  • Integrates features into the main codebase without disturbing it.
  • Conflicts may appear.

Pull Requests

  • PRs are the recommended way of merging content between branches.
  • Process: create branch > develop feature > make a pull request into master/main > request code review > improve according to feedback > pull req > merge.

Rebasing

  • Rebasing is a merging strategy consisting of staking changes by moving the tip of a source branch to the latest commit of the other and then sequentially applying commits on top of that, thus maintaining a more linear (history-clean) process.

Try It Out

  • Clone the vdf repo both via https/ssh.
  • Create new branches.
  • Use the same branch as other devs (conflicts?).
  • Commit, push, and pull changes.

Software Testing: Testing Methods & Automation

Ce este testarea? TESTING (What is Testing?)

  • Reprezintă modalitatea prin care se verifică calitatea soluției dezvoltate (Represents the way of verifying the quality of the developed solution).
  • Testele sunt împărțite în mod uzual în 3 categorii: unit test, test de integrare și test de system (Tests are usually divided into 3 categories: unit test, integration test and system test).
  • Scopul testării este de a descoperi diferite comportamente neașteptate sau puncte de eșec (The purpose of testing is to discovered different unexpected behaviors or points of failure).
  • Testarea include nu doar executarea codului dar șiverificarea acestuia. Este comportamnetul dupa execuție cel așteptat ? (Testing includes not only executing the code but also checking it. Is the behavior after execution what is expected?).
  • Tipul și scopul testării diferă în funcție de tipul de produs creat. (Nu aveam aceeasi testare pentru jocuri sau pentru sisteme vitale) (The type and scope of testing differs depending on the type of product created. (We don't have the same testing for games or for vital systems)).

CE ESTE TESTAREA? UNIT TESTING (What is Testing? UNIT TESTING)

  • Unit test:
    • Sunt teste automate prin care se verifică anumite zone specifice (unit-uri) (Are automated tests that verify certain specific areas (units)).
    • Ajută la rezolvarea de bugs în fazele de început ale dezvoltării (Help solve bugs in the early stages of development).
    • Scrierea de unit test se poate face mai rapid și mai curat folosind teste parametrizate. Astfel se poate face executarea aceluiași test cu diferiți parametri (Writing unit tests can be done faster and cleaner using parameterized tests. Thus it is possible to execute the same test with different parameters).
    • Software: Junit, NUnit, JMockit, EMMA, PHPunit.

CE ESTE TESTAREA? UNIT TESTING (What is Testing? UNIT TESTING)

  • Tehnici de unit test (Unit test techniques):
    • Black box presupune testarea unei interfețe de la datele de intrare până la datele de ieșire (Black box assumes testing an interface from input data to output data).
    • White box presupune testarea comportamentului aplicației (White box involves testing the behavior of the application).
    • Grey box folosit pentru a executa diferite cazuri de testare, metode șio analiză de risc (Grey box used to execute different test cases, methods and risk analysis).

CE ESTE TESTAREA? TESTE DE INTEGRARE (What is Testing? INTEGRATION TESTS)

  • Testele de integrare reprezintă momentul în care mai multe module individuale urmează sa fie testate împreuna pentru a studia modul în care acestea se integrează (Integration tests represent the moment when several individual modules are to be tested together to study how they integrate).
  • Acestea sunt concepute pentru a asigura că o nouă funcționalitate se integrează cu ușurintă și fără erori (These are designed to ensure that new functionality integrates smoothly and without errors).

CE ESTE TESTAREA? TESTE DE SYSTEM (What is Testing? SYSTEM TESTS)

  • Testele de sistem reprezintă teste ce se fac pe sisteme complete pentru ca verifica comformitatea cu cerințele intițiale (System tests are tests that are performed on complete systems to verify compliance with initial requirements).
  • Acestea primesc ca șidate de intrare toate componentele care au trecut testele de integrare (These receive as input all components that have passed integration tests).
  • Scopul testelor de sistem este de a descoperi greșeli în legătură cu componentele integrate dar și cu întregulsystem (The purpose of system tests is to discover errors related to the integrated components but also to the entire system).

SELENIUM

  • Selenium este o soluție open source pentru testarea de soluții web (Selenium is an open source solution for testing web solutions).
  • Acesta oferă o interfață prin care se pot testa multe limbaje diferite de programare : Ruby, Java, NodeJS, PHP, Perl, Python și altele (It provides an interface through which many different programming languages can be tested: Ruby, Java, NodeJS, PHP, Perl, Python and others).
  • Exemplu de test (Test example):
    • Să prespunem ca avem o aplicație nouă pentru care tocmai am terminat de dezvoltat formualrul de login șine dorim testarea acestuia (Let's assume that we have a new application for which we have just finished developing the login form and we want to test it).
    • Presupunem ca avem un username, parola și adresă mail (Assume we have a username, password and email address).

SELENIUM

  • Pași de urmat (Steps to follow):
    1. Creeare instaanță de Selenium (Create Selenium instance)
    2. Configurare browser (Browser configuration)
    3. Navigare pagină de login (Login page navigation)
    4. Localizare elemente web (driver.findElement(By.id("user")) (Locate web elements (driver.findElement(By.id("user")))
    5. Aplicare acțiuni pe elementele web (login.click()) (Apply actions on web elements (login.click()))
    6. Verificare șivalidare acțiuni(Assert.assertEquals(String actual, String expected) (Action checks and validations (Assert.assertEquals(String actual, String expected))

GITHUB ACTIONS

  • GitHub Actions este o platformă destinată utilizării în continous integration and continous delivery (CI/CD) ce ne permite automatizarea buildului, testării si pipelineurilor de deploy (GitHub Actions is a platform intended for use in continuous integration and continuous delivery (CI/CD) that allows us to automate the build, testing and deployment pipelines).
  • Îți poti creea diferite fluxuri de lucru(wokflows) care să ruleze șitesteze fiecare pull request in repository sau să facă deploy direct la modificări în producție (You can create different workflows that run and test each pull request in the repository or deploy changes directly to production).
  • GitHubActions oferă capabilități peste necesitățile uzuale ale DevOps șiiti permite sa creezi fluxuri de lucru pentru diferite acțiuni(Ex: flux de lucru ce adauga automat tag-uri pentru issues) (GitHubActions offers capabilities beyond the usual needs of DevOps and allows you to create workflows for different actions (Ex: workflow that automatically adds tags for issues)).

GITHUB ACTIONS WORKFLOWS

  • Fiecare flux de lucru conține una sau mai multe joburi ce se rulează secvențialsau în paralel (Each workflow contains one or more jobs that run sequentially or in parallel).
  • Fiecare job se ruleaza în interiorul unei mașini virtuale numită ”runner” sau în interiorul unui container. Joburile conțin mai mulți pași care pot să rulezediferite scripturi sau acțiuni (Each job runs inside a virtual machine called