Difference Between Unit Testing and Integration Testing

Kiran Kumar Panigrahi
Updated on 22-Feb-2023 14:54:57

4K+ Views

Testing is the most important stage in the process of delivery of any software product, as it not only validates the quality of the product but also provides an opportunity to the developer to improve it further. Unit testing and integration testing are both software testing techniques, but they are quite different from each other in their scope and they focus on different parts of the software. Read this article to learn more about unit testing and integration testing and how they are different from each other. What is Unit Testing? Unit testing is a type of testing technique in ... Read More

Append a String in an Existing File using Go

Akhil Sharma
Updated on 22-Feb-2023 14:52:52

1K+ Views

In Golang, we can use io and os packages to append a string in an existing file. file contains data that can be manipulated in many ways like editing and writing the data. In this article the first method will demonstrate the application of os.Open file of OS package. In the second method, we are going to demonstrate the application of io package. Method 1: Using OS Package In this method, we are going to use os.OpenFile function of OS package in Golang. The permissions for the file are specified by the 0644 parameters. The file will be created ... Read More

Get File Extension in Go

Akhil Sharma
Updated on 22-Feb-2023 14:51:41

7K+ Views

In golang, we can use the path package and string package to get the extension of a particular file. Here, in his article, we will obtain the file extension using two methods. In the first method, we will use path package function path.Ext. In the second method, we will use strings package function strings.LastIndex. Method 1: Using Path Package In this method, we will use path.Ext from path package to get the file extension. This built-in function will take the file as an input whose extension is to be printed. Syntax path.Ext The Go path/filepath package makes it easier ... Read More

Difference Between Top-Down Parsing and Bottom-Up Parsing

Kiran Kumar Panigrahi
Updated on 22-Feb-2023 14:50:48

44K+ Views

Top-Down Parsing and Bottom-Up Parsing are used for parsing a tree to reach the starting node of the tree. Both the parsing techniques are different from each other. The most basic difference between the two is that top-down parsing starts from top of the parse tree, while bottom-up parsing starts from the lowest level of the parse tree. Read this article to learn more about top-down parsing and bottom-up parsing and how these two parsing techniques are different from each other. What is Top-Down Parsing? Top-Down Parsing technique is a parsing technique which starts from the top level of the ... Read More

Get Relative Path from Two Absolute Paths in Golang

Akhil Sharma
Updated on 22-Feb-2023 14:50:38

5K+ Views

To get the relative path from two absolute paths in golang, we use filepath and string packages. Relative paths tell the location of file with respect to present working directory whereas absolute paths tell the location of file starting from root directory. In the first method we will use filepath package functions and in the second method we will use strings package function. Method 1: Using Filepath Package In this program, the base name of the file, which is the file name without the directory path, is extracted using the filepath.Base function from the path/filepath package. The name of the ... Read More

Get File Name from Absolute Path in Go

Akhil Sharma
Updated on 22-Feb-2023 14:49:18

11K+ Views

We are going to use the filepath and string functions of golang to get the file name from the absolute path. An absolute directory begins with the root directory and includes all intermediate directories. In the first method, we will use filepath package functions and in the second example, we will use strings package functions. Method 1: Using filepath Package The base name of the file, which is the file name without the directory path, is extracted in this program using the filepath.Base function from the path/filepath package. The name of the extracted file is then displayed on the console. ... Read More

Difference Between Testing and Checking

Kiran Kumar Panigrahi
Updated on 22-Feb-2023 14:48:29

1K+ Views

In general, we can say that both Testing and Checking are used to evaluate a software product to make sure it behaves as expected. Both these processes are performed before the delivery of the product to ensure the delivery of correct and genuine product. Read this article to learn more about Testing and Checking and how they are different from each other. What is Testing? Testing is defined as a process of validating a product along with learning about that product by investigating and exploring the product during the process. Thus, testing is the process that motivate the tester to ... Read More

Golang Program to Create Directories

Akhil Sharma
Updated on 22-Feb-2023 14:48:16

2K+ Views

Golang has internal packages like os and io packages for creating a new directory. Here, we will create a directory using two examples. In the first example we will use os.Mkdir function and in the second example we will use ioutil.WriteFile function to execute the program. Method 1: Using os.Mkdir Function In this method, a directory named dirName variable is created using the os.Mkdir function. The permission bits for the new directory are the second input to os.Mkdir, which we set to 0755. (read, write, and execute permissions for the owner and read and execute permissions for others). The program ... Read More

Delete Empty and Non-Empty Directory in Go

Akhil Sharma
Updated on 22-Feb-2023 14:47:05

2K+ Views

In golang, we can use os and dir packages to delete a given directory. Here we are using two examples to demonstrate to deletion of an empty and non-empty directory using os.open, os.Removeall. Syntax os.Open This function is a part of os package. It is used to open a file to read. It takes one input i.e. the filename which will be opened. os.RemoveAll It removes the directory and its contents completely. The function takes the name of the directory as an argument. dr.ReaddirNames This function is useful to read the file names from a directory. ... Read More

Golang Program to Rename a File

Akhil Sharma
Updated on 22-Feb-2023 14:44:50

809 Views

In golang we can use internal function of OS package to rename a file in various ways. In this article we are going to demonstrate how to change a file name using os. create, os.rename and os.open functions. Method1: Using os.Rename Function In this example, the file oldname.txt is renamed to newname.txt using the Rename function. If the renaming does not occur, such as if the source file doesn't exist or if the destination file already exists, the function produces an error by panicking. The error will be nil if the renaming procedure is successful. Syntax os.Rename os.Rename is ... Read More

Advertisements