Showing posts with label Example. Show all posts
Showing posts with label Example. Show all posts

Thursday, September 24, 2020

Quality Assurance (QA) VS Quality Control (QC)

Quality assurance (QA) are actions taken to design and build a safe and effective product by introducing quality controls into the product life cycle. 

Quality control (QC) are test procedures used to verify that a product is safe and effective after development is done. Both QA and QC are necessary.


1. Proactive (QA) vs. Reactive (QC)

Effective quality assurance is proactive. It aims to prevent defects before they occur through process design. QC is reactive and exists to identify defects after they have happened.

QA involves the design of processes. QC involves the testing of products to ensure they meet standards. If QC testing uncovers quality issues, it should result in reactive steps to prevent a product from being released.


2. Process (QA) vs. Product (QC)

QA is process-oriented, and it focuses on preventing quality issues. QC is product-oriented and focused on identifying quality issues in developed products. Another way to understand this distinction is through actions vs. results. QA involves the actions which create the product, while QC is focused on the resulting product. 


QA Processes:

  • Documentation (Test Strategy, Test Plan, etc.)
  • Investigation procedures (Audits, Reports)

QC Procedures:

  • Verification testing
  • Functional testing
  • Integration testing
  • Non-Functional testing


3. System (QA) vs. Methods/Services (QC)

Quality assurance control systems are the methods and procedures which are used to safeguard quality standards. Quality control systems measure parts, including the outputs of the system.

QC efforts may also be focused on parts used to create the final product, such as methods or functions. The QA system for quality management may dictate various activities to make sure inputs are consistently safe and effective, such as auditing external dependencies.


4. Validation (QA) vs. Verification (QC)

The result of QA activities is a roadmap for creating high-quality products (for example it involves defining standards for product as a whole).

QC involves verification of products post-development and before release.


5. Entire Team (QA) vs. Dedicated QA (QC)

Quality assurance activities involve the entire team. Every member of a team is responsible for QA activities.

QC is generally the responsibility of certain members within the team whose duties include following requirements for product testing. 

Thursday, April 19, 2018

Working with ZIP in terminal

Couple of days ago wanted to use ZIP in OSX terminal and realised that I don't have examples really (yes U can check manuals etc.) so I've decided just to note most common / usable ones:

- zip --encrypt file.zip files - will create an encrypted zip archive (files won't be removed automatically after compressing);

- zip -r archive.zip directoryName - will compress whole directory at once. U can add --encrypt flag here as well

- unzip file.zip - extracts file from archive into current directory

That's it for now although most likely will have to add more later on.

Wednesday, March 29, 2017

Working with zipfile module Python

Memo related to zipfile module and most common methods from this module.

import zipfile

compressedFile = zipfile.ZipFile('test.zip')

compressedFile.namelist() - returns list of files and directories in archive

fileInfo = compressedFile.getinfo('file') - returns information about file in archive

fileInfo.file_size - returns size of the file

fileInfo.compress_size - returns compression ratio

compressedFile.extractall() - extracts everything from zip into current directory

compressedFile.extractall(path) - extracts everything from zip to destination directory

compressedFile.extract('file', path) - extracts exact file from zip to destination path


newZip = zipfile.ZipFile('test.zip', 'w')
newZip.write('test.txt', compress_type=zipfile.ZIP_DEFLATED)
newZip.close() - adding file to archive however this will overrides all archive

zipfile.ZipFile('test.zip', 'a') - adding file to archive without overriding 


Working with files in Python (part 2) - shutil, move2trash, os

In this memo I'll save some common methods related to shutil, move2trash modules and some more from os module.

shutil.

import shutil

shutil.copy('source', 'destination') - copies file or directory

shutil.copytree('source', 'destination') - copies directory with all subdirectories & files

shutil.move('source', 'destination') - moves file or directory

shutil.remtree(path) - remove directory with all subdirectories


send2trash.

import send2trash

send2trash.send2trash(path) - moves file or directory to the bin


os.

import os

os.walk(path) - returns list of all directories, subdirectories and files

os.unlink(path) - permanently deletes file

os.rmdir(path) - permanently removes directory

Sunday, March 26, 2017

Regex rules for Python...

Something to keep in mind about Regex.

? - matches zero or one of the preceding group
* - matches zero or more of the preceding group
+ - matches one or more of the preceding group
{n} - matches exactly n of the preceding group
{n,} - matches n or more of the preceding group 
{,m} - matches 0 to m of the preceding group 
{n,m} - matches at least n and at most m of the preceding group
{n,m}? or *? or +? - performs a nongreedy match of the preceding group 
^spam - means the string must begin with spam
spam$ - means the string must end with spam
. - matches any character, except newline characters
\d, \w and \s - match a digit, word, or space character
\D, \W and \S - match anything except a digit, word or space character
[abc] - matches any character between the brackets
[^abc] - matches any character that isn't between brackets


In order to use  package re should be imported after that compile method can be invoked:

regex = re.compile(r'spam')

Some useful methods:

regex.search('abc') - returns first occurrence of matched pattern
regex.group(1) - returns first group in case of multiple of those ie re.compile(r'(\d\d)-(\d\d\d))
regex.group() - returns the entire matched text
regex.groups() - returns tuple of multiple values
regex.findall() - returns the strings of every match in the searched string ie list of strings if there's more than 1 match
regex.sub() - takes two arguments: first string for replacement and second string where to replace (in case of match) ie regex.sub(r'abc', 'abc is the most popular shortcut')

List is not complete and I will try to add some more examples later...


Math calculation with Bash in OSX

There are quite a few options how to calculate with Bash in OSX terminal but for reference I'd like to mention just several of them which can be used as a baseline.

echo "2 * 2" | bc

echo "scale=3; 1000/52 | bc" - will output result + 3 digits after comma

bc <<< "100 / 3"

bc -l <<< "sqrt(5)" (scale(3.3) - number of digits after comma, length(100) - number of digits)

awk "BEGIN {print 33 * 33}"


Wednesday, May 11, 2016

Enum and Property file cooperation in Java

Short reminder how to populate Enum in Java with values from property file.

1. Create an Enum as described in example below:

 public enum Users {  
   USER_1, USER_2;  
   private static final String PATH = "/selenium/environment/users.properties";  
   private static Properties properties;  
   private String value;  
   private void init() {  
     if (properties == null) {  
       properties = new Properties();  
       try {  
         properties.load(Users.class.getResourceAsStream(PATH));  
       }  
       catch (Exception e) {  
         e.printStackTrace();  
       }  
     }  
     value = (String) properties.get(this.toString());  
   }  
   public String getValue() {  
     if (value == null) {  
       init();  
     }  
     return value;  
   }  
 }  

Of course it's not an ideal solution and You may come up with better one but this works for me as expected and that's all I need.

2. Create a properties file (short reminder - this file should be placed into resources folder in Your project)

 USER_1=secretlogin1  
 USER_2=secretlogin2  

in this case we have just two entries but You can expand that.

3. Call that from code

 journey.login(Users.USER_1);  

Well it's pretty much it and hopefully this will save me from "googling" next time I'll need such code.

Saturday, April 9, 2016

Change File Permissions in Terminal OSX

Knowledge about changing permissions for a specific file is pretty important and can even save Your information from being lost.

So let's see what we can check and how.

1. Execute next command in Your terminal window:

$ ls -la

You should see same information as on screen below.


What do those letters form first column stand for?
- d = directory
- r = read access
- w = write access
- x = execute access
- - = no permissions at all

Column 3 indicates owner of a file and column four shows us an user's group which might has or not permissions to read/write/execute file.

So if we'll check first column again from left to write we'll see that:

- first symbol / several symbols - user's permissions
- second symbol (after dash) / symbols - group permissions
- third symbol / symbols - all other users permissions

Let's analyse example.txt file:

- user has read and write permissions
- group has read and write permissions
- other users have only read permission

2. If You want to change ownership of the file just execute:

$ sudo chown NEW_USER:NEW_GROUP example.txt

this command will update owner and group for this file.

3. If You want just update permissions for specific file then You need to execute:

$ sudo chmod 000 example.txt

this command deny all actions with this file for all users.

4. Let's explore octets in general:

- 0 - No read, no write, no execute  - " - "
- 1 - No read, no write, execute       - " -x "
- 2 - No read, write, no execute       - " -w- "
- 3 - No read, write, execute            - " -wx "
- 4 - Read, no write, no execute      - " r- "
- 5 - Read, no write, execute           - " r-x "
- 6 - Read, write, no execute           - " rw- "
- 7 - Read, write, execute                - " rwx "

5. So according to this table if we'll execute next command:

$ sudo chmod 432 example.txt

- owner will be able only to read file;
- group will be able to write and execute;
- all others will be able only to write.

6. If You want to apply same permission to folder and all its content You have to add one more flag to Your command:

$ sudo chmod -R 777 Documents

This is pretty much core knowledge which You have to have in order to change permissions for folder / file in OSX terminal.

Wednesday, October 14, 2015

Working with files in Java

Really obvious things for a lot of developers - but I still want to keep them here. You can blame me for not keeping them in mind - but I still don't have an answer what for :)

Reading from file:

public void readFile() {
        String str;
        try {
            File file = new File("Full path to file here");
            BufferedReader bufferedReader = new BufferedReader(new FileReader(file));

            while ((str = bufferedReader.readLine()) != null) {
                isTestHeaderString(str);
            }
            bufferedReader.close();
        } catch (IOException exception) {
            exception.toString();
        }
    }


Writing to file:

public void writeToFile() {
    try {
        new File("Path do directory if we need that").mkdir();
        File file = new File("Path & name for file");
        BufferedWriter writer = new BufferedWriter(new FileWriter(file));
        writer.append("What we actually want to write goes here");
        writer.close();
   } catch (IOException exception) {
        exception.toString();
   }
}

I'm not adding here any synchronisation / multi threading things - might add them later.