The dns.resolveSoa() method uses the DNS protocol to resolve the start of authority records for the hostname. The address argument passed to the callback function will be an object that will contain the following properties −nsnamehostmasterserialrefreshentryexpireSyntaxdns.resolveSoa(hostname, callback)ParametersIt accepts the following parameters −hostname – This parameter takes the input for the hostname to be resolved.callback – This function will catch errors, if any.records – Returns the start of authority records for the hostname.ExampleCreate a file with the name "resolveSoa.js" and copy the following code snippet. After creating the file, use the command node "resolveSoa.js" to run this code as shown in ... Read More
We can download file using Node.js by either using third-party libraries or using some inbuilt packages.Method 1: Using 'https' and 'fs' moduleWe can use the http GET method to fetch the files that are to be downloaded.The createWriteStream() method from fs module creates a writable stream and receives the argument with the location of the file where it needs to be saved.pipe() is another method from fs that reads the data from the readable stream and writes it onto the writable stream and file.Example 1Create a file with the name downloadFile.js and copy the following code snippet. After creating the ... Read More
The diffieHellman.computeSecret() is used for computing the shared secret using the public key of other's party and returning the computed shared secret. The suppliedKey is interpreted using the specified inputEncoding and the secret is encoded using the specified outputEncoding. If the inputEncoding is not specified the other publicKey is expected to be a buffer, DataView.SyntaxdiffieHellman.computeSecret(otherPublicKey, [inputEncoding], [outputEncoding])ParametersotherPublicKey – This is the public key that is used to compute the secret.inputEncoding – This encoding is used to interpret the supplied key.outputEncoding – This encoding is used for encoding the computed secret value.Example 1Create a file with the name "computeSecret.js" and copy ... Read More
TestNG supports multithreading, i.e., a @Test methods can be invoked in parallel. A test or multiple test methods can be invoked from multiple threads. Therefore, multithreading is useful if @Test methods need to be run asynchronously in parallel.Multithreading can be achieved by using the keyword "thread-count=" at Testng.xml. Thread count is basically a number of instances running to execute multiple tests simultaneously or in parallel. The attribute thread-count allows the user to specify how many threads should be run for this execution.In this article, we will illustrate how to achieve multithreading.Approach/Algorithm to solve this problemIn this example, five @Test methods ... Read More
A TestNG class can have various TestNG methods such as @BeforeTest, @AfterTest, @BeforeSuite, @BeforeClass, @BeforeMethod, @test, etc. In this article, we will explain the order of execution of different TestNG methods.TestNG consists of the following methods to support the main @Test method. The order of execution should be as follows − Key points in this order are:First of all, beforeSuite() method is executed only once.The afterSuite() method executes only once.Even the methods beforeTest(), beforeClass(), afterClass(), and afterTest() methods are executed only once.beforeMethod() method executes for each test case (every time for a new ... Read More
A TestNG class can have various TestNG methods such as @BeforeTest, @AfterTest, @BeforeSuite, @BeforeClass, @BeforeMethod, @test, etc. In this article, we will explain the order of execution of different TestNG methods.TestNG consists of the following methods to support the main @Test method. The order of execution should be as follows − Key points in this order are:First of all, beforeSuite() method is executed only once.The afterSuite() method executes only once.Even the methods beforeTest(), beforeClass(), afterClass(), and afterTest() methods are executed only once.beforeMethod() method executes for each test case (every time for a new ... Read More
TestNG supports default report generation when a user runs testng.xml, either from an IDE or the command line. By default, all reports are generated at the Project -> test-output folder. If the test-output folder is not present, then TestNG creates it at runtime and saves all the files related to the result.However, the user can provide a desired location or folder name where TestNG should save the reports. It can be done using native dependency injection. It allows to declare additional parameters in methods. At runtime, TestNG automatically fills these parameters with the correct values.To set up the output directory ... Read More
TestNG supports multiple ways to skip or ignore a @Test execution. Based on requirement, the user can skip a complete test without executing it at all or skip a test based on a specific condition. If the condition meets at the time of execution, it skips the remaining code in the test.One can use the following ways to skip a @Test execution −Use the parameter enabled=false at @Test. By default, this parameter is set as True.Use throw new SkipException(String message) to skip a test.Conditional Skip − User can have a condition check. If the condition is met, it will throw ... Read More
TestNG supports native dependency injection. It allows to declare additional parameters in methods. At runtime, TestNG automatically fills these parameters with the correct values. Here's a set of native dependencies in TestNG:ITestContextXmlTestMethodITestResultThese dependencies help to retrieve the name of Test method. The name of a Test method can be retrieved before or after the execution of the test.If the user wants to get the name of a Test method prior to its execution, then @BeforeMethod can be useful to retrieve it.On the other hand, if the user wants to know which Test method is just executed, then @AfterMethod can be ... Read More
TestNG supports multiple ways to skip or ignore a @Test execution. Based on requirement, a user can skip a complete test without executing it at all from BeforeSuite, if a condition is met. If the condition meets at the time of execution, it skips the running of @Test methods.Conditional Skip is a proper way to force-end an entire test suite, if a condition is met in @BeforeSuite method.Conditional Skip − User can have a condition check. If the condition is met, it will throw a SkipException and skip the rest of the code.In this article, we will demonstrate how to ... Read More
 
 Data Structure
 Data Structure Networking
 Networking RDBMS
 RDBMS Operating System
 Operating System Java
 Java MS Excel
 MS Excel iOS
 iOS HTML
 HTML CSS
 CSS Android
 Android Python
 Python C Programming
 C Programming C++
 C++ C#
 C# MongoDB
 MongoDB MySQL
 MySQL Javascript
 Javascript PHP
 PHP 
		