Skip to content

Instantly share code, notes, and snippets.

@hiba-machfej
Created May 9, 2024 08:52
Show Gist options
  • Save hiba-machfej/4445705bdeac1741930404d7ef863c6b to your computer and use it in GitHub Desktop.
Save hiba-machfej/4445705bdeac1741930404d7ef863c6b to your computer and use it in GitHub Desktop.

Discussion questions:

1- What is test coverage, and why is it important?

2- Should you do 100% test coverage? What should you consider while determining the right level of test coverage?

3- How does static analysis testing differ from unit testing?

4- What are some common tools used for static analysis testing in JavaScript?

5- How can developers enforce static analysis rules across their team projects?

6- What is CI/CD and why are automated testing and CI/CD important?

7- How can Husky and GitHub Actions help enforce CI/CD practices?

@Elaf-Gardi
Copy link

Elaf-Gardi commented May 9, 2024

Elaf Gardi, Rawan Mustafa, Ninos Dinkha, Ibrahim muhaned, Hana Abdulla and Maram qais

1- Test coverage is the percentage of a software application's code tested by its test suite. It is important since it ensures that the tests are thorough and capable of detecting potential defects or vulnerabilities in the codebase.

2- Trying to get 100% test coverage isn't always required or possible. The appropriate level of coverage depends on project requirements, risks, and resources. Determine the appropriate level of coverage by taking into account important features, probable failure sites, and test prioritization.

3- Static analysis testing analyzes code without running it, looking for possible bugs like as coding standards violations, security vulnerabilities, or code complexity. Unit testing, on the other hand, involves running single code units to ensure their behavior and operation, usually focused on individual functions or methods.

4- Tools used for static analysis testing in JavaScript include ESLint, JSHint, and JSLint.

5- Developers can enforce static analysis rules across their team projects by integrating static analysis tools into their continuous integration pipelines, configuring shared rule sets, and conducting regular code reviews to ensure compliance

6- CI/CD is Continuous Integration/Continuous Delivery. Automated testing and CI/CD are crucial for improving code quality, speeding up development, and ensuring reliable software delivery.

7- Husky enforces pre-commit and pre-push hooks for local testing, while GitHub Actions automates testing and deployment workflows, ensuring continuous integration and delivery practices are followed.

@Nada-235
Copy link

Nada-235 commented May 9, 2024

Room 8
Abdulrahman Khalil | Nada | Payam | Zhin Abubakr | Mohammed Nazar | Papula

  1. Test coverage defines what percentage of application code is tested and whether the test cases cover all the code. 
    Importance of Test Coverage:
    1- Increased defect detection: By covering a wide range of code and functionalities.
    2- Risk reduction: High test coverage mitigates the risk of undetected bugs and improves overall software reliability.
    3- Confidence in code changes: With comprehensive test coverage, developers can make changes to the codebase confidently, knowing that the tests will catch any unintended consequences.

  2. Achieving 100% test coverage may not always be necessary or feasible, as it could lead to diminishing returns. The right level of test coverage depends on factors such as criticality of the software, complexity, risk tolerance, and resource constraints.

  3. Static Analysis Testing vs. Unit Testing:
    Static Analysis Testing:

  • Checks code without running it.
  • Looks for errors, vulnerabilities, and coding standards issues.
  • Examples: linters, code analyzers.

Unit Testing:

  • Tests individual parts of code by running it with specific inputs.
  • Verifies functional behavior.
  • Examples: Jest, Mocha.
  1. Common Tools for Static Analysis Testing in JavaScript:
    ESLint: Checks JavaScript code for errors and coding style issues.
    JSHint: Identifies potential problems in JavaScript code.
    Flow: Detects type errors in JavaScript code.

  2. Developers can enforce static analysis rules across team projects by:
    1- Establishing coding standards and guidelines.
    2- Conducting regular code reviews.
    3- Integrating static analysis tools into CI pipelines.
    4- Using IDE plugins for real-time feedback.
    5- Utilizing linting tools and automated code formatting.
    6- Developing custom scripts for specific rules.
    7- Providing education and training on static analysis importance.

  3. CI/CD, or Continuous Integration/Continuous Deployment, automates code integration, testing, and deployment processes. Automated testing and CI/CD are crucial for faster delivery, improved code quality, consistency, collaboration, rapid feedback, and scalability in software development.

  4. Husky and GitHub Actions can work together to enforce Continuous Integration/Continuous Deployment (CI/CD) practices by automating certain tasks and ensuring that code changes adhere to predefined standards before being merged into the main codebase. Here's how they can help:
    1- Husky's pre-commit/pre-push hooks ensure local code meets standards.
    2- GitHub Actions automates testing and deployment workflows.
    3- They integrate to run tests, checks, and deployments consistently.
    4- Developers' local checks align with GitHub's server-side checks.
    5- Automated testing and deployment reduce manual errors.
    6- Code formatting and style guidelines are enforced for consistency.

@Mardin-luqman2001
Copy link

Mardin-luqman2001 commented May 9, 2024

Jwan Kareem, Ali Izzaldin, Mardin Luqman, Mawj M.basheer, Halwest Abubakir
1- In simple terms, it is a technique to ensure that your tests are testing your code or how much of your code you exercised by running the test.
Eliminates_ defects at early stages, Removes redundant cases

2- 100% test coverage isn't always necessary. Consider:
Code criticality
Risk tolerance
Time/resources
Business requirements
Maintenance overhead

3- static analysis testing is a preventative measure that checks code for errors without executing it, while unit testing is a corrective measure that checks the functionality of individual units of code by executing them

4- ESLint is widely used for JavaScript static analysis, offering extensive rule customization. Standard JS is opinionated like Prettier but includes rules beyond styling. JSHint is similar to ESLint but with fewer rules and customization options. PMD is a linter for Java and Salesforce Apex. LGTM provides linting based on predetermined rules, but it's limited by what you define.

5-Developers can enforce static analysis rules across their team projects by integrating static analysis tools into their continuous integration (CI) pipelines. This ensures that code is automatically checked against predefined rules whenever changes are made or new code is added. Additionally, developers can establish coding standards and guidelines, use configuration files for static analysis tools, and regularly review code to ensure compliance with the defined rules. Training sessions and documentation can also help reinforce the importance of following static analysis rules within the team.

6-CI/CD (Continuous Integration/Continuous Deployment) is a set of best practices, principles, and tools used by software development teams to automate the process of building, testing, and deploying software. It offers several benefits

7- Husky sets up Git hooks for automating tasks like linting and testing. GitHub Actions automates workflows triggered by events like commits or pull requests, facilitating CI/CD pipelines directly within GitHub. Together, they enforce CI/CD practices, maintain code quality, and automate development workflows.

@candourist
Copy link

candourist commented May 9, 2024

Room 1:

- Ahmed Isam
- Ahmad Qarany Farhan
- Didam Goran
- Mohammed Nazm
- Sarah Mustafa
- Sajad Ismael
- Shvan Abdulhakeem

  1. Test coverage refers to the percentage of code covered by unit tests. It's important because it helps ensure all code is tested and reduces the likelihood of regressions being introduced. Tests provide documentation of how code is expected to behave and allow refactoring safely.

  2. 100% coverage isn't always feasible or necessary. Consider business needs, risk levels of each code section, cost of additional testing, and whether all code lends itself to being tested. Coverage should be maximized for critical and complex code, while less risky code may not need as much testing.

  3. Static analysis checks code for bugs and errors without running the code, unlike unit tests which execute code snippets. It catches logic errors like unused variables and missing cases. Unit tests validate behavior through execution. Static analysis is faster and catches problems early in the development cycle.

  4. For JavaScript, common static analysis tools include ESLint, JSHint, and Prettier for linting/formatting code. TypeScript also adds type checking capabilities. These help enforce code quality and standards.

  5. Static analysis rules can be defined in configuration files checked into version control. Tools like ESLint can then be run during CI/CD to check code commits comply with standards before merging. This ensures consistency across the codebase.

  6. CI/CD automates the build, test and deployment process. It helps catch errors quickly, improves code quality through testing, and facilitates faster, more reliable software releases. Automated testing is a key part of CI/CD as it prevents regressions and ensures code quality.

  7. Husky and GitHub Actions help implement CI/CD best practices. Husky runs scripts like linting and testing on commit/push. GitHub Actions can run tests and deploy code automatically on code changes through pull requests and merges. Together they ensure code quality and prevent bugs from being introduced or released to production.

@Dilan-Ahmed
Copy link

Dilan-Ahmed commented May 9, 2024

Dilan Ahmed | Aras Yousef | Barham Baper | Hanan Islam | Omar Sardar | Aland Rebwar

  1. Test Coverage is used in measuring how comprehensive or limited the source code is being tested already. in the result, it gives the percentage of code on which a test is being executed .
    The test coverage is important because of its usage we will be aware of areas in the source code that had not been covered in the test; therefore helps th e developers to concentrate on testing in the areas which in need to be tested .Also it is important for the quality testing as well as risk measurements and analytics related to the source code.

2)Aiming for getting 100% test score in testing a source code could be easily unrealstic goal . as there are many factors that avoid this kind of perfect scores so it is better to aim for a realistic practical score. it is better to aim for having great scores coming from critical aspects of the code base we have for example the functionalities , risk vulnerabilities, and other relative parts of the code which are important to deliver the main goal or purpose of the source code.

  1. the static analysis is more focused on analyzing the code we have without executing the code actually. it is more into checking the way the code is structured, predicted and possible vulnerabilities, and any other criteria of the code base. this analysis is performed during the early phase of development process. on the other hand we have unit testing which is more focues on testing the code base we have through executing the specific parts or units of the code respectively in different sections. moreover, its aim is to be the reference of the devolpers to verify the functionalitie and required performance of teh code that htey have.

  2. the static analysis can be done through having some common tools such as :
    ESLint is used for erorr detection in the code.
    JSHint is used for detecting and finding potential problems in JS code.
    JSLINT is one of the older tools yet still used widely in static analysis .
    FLOW is one of the tools and being developed by FACEBOOK which another ststic tool for finding early problems and issues we might have in the code base.

  3. Developers can easily enforce Static Analysis rules across their team projects through usinga tool like ESLint or Pylint which defines the standrads of the coode.

  4. CI/CD is Continuous Integration and Continuous Deployment which is a collection of practices sued in Software development inorder to automate the test creation and executeion with code demployment alterations .They are important for early detection of issues and problems in the code,. it also contribute in making the code be more consistent as having a consistent automated test will make sure to have a consistent code aswell

  5. both are tools that being helpful in enforcing CI/CD practices thorugh automation of tasks we hve in development and deployment. Husky is a Git Hook maanger that helps to run scripted codes automatically during any git events that we might have. Husky helps also in enforcing pre commit and pre push hooks to perform tasks such as runnting tests. on the other hand we have GitHub Actions which is more like a platform that we have for workflows automations in Github repos which allows develpers to customize the workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment