Quantcast
Channel: RESPEC
Viewing all articles
Browse latest Browse all 59

Testnap is Your Friend

$
0
0

Jessica Boepple - SSG Oracle BRMWhen it comes to testing in BRM, you’ve got a friend in testnap. Testnap is a versatile command-line utility that you can use to test your BRM applications and execute opcodes. With testnap, you can perform the following tasks:

  • Create input flists
  • Test the validity of input flists
  • Save input and output flists
  • Execute opcodes
  • View return flists
  • Create, view, modify and delete objects and their fields
  • Open, commit and abort transactions
  • And more!

Benefits of using testnap

Testnap is an incredibly powerful tool. As seen above, it has many possible excellent uses that make testing easier and more robust. Some of testnap’s most helpful attributes are listed below.

  • With its informative error messages, testnap tells you where the problem occurs, allowing you to easily pinpoint and correct errors.
  • Testnap also logs more detailed explanations to a pinlog about why an action might be invalid or why an error is occurring.
  • Testnap allows you to execute a wide variety of tests all in one place, making it a wonderfully convenient tool!

Where to use testnap

Testnap interacts with the server by establishing a PCM connection with the Connection Manager (CM) and executing PCM opcodes using that connection. To connect to your BRM system, the testnap utility requires a pin.conf configuration file. You may choose to use the CM’s pin.conf file, running testnap in BRM_Home/sys/cm, or you may choose to run testnap from another directory that contains a suitable pin.conf file, such as BRM_Home/sys/test.

Creating a testnap script

The basic format of a testnap script looks like this:

[1] r << XXX 1
[2] 0 PIN_FLD_POID POID [0] 0.0.0.1 /account 56375 13
[3] XXX
[4] d 1
[5] robj 1

The line numbers in [brackets] above are just shown for clarity and are NOT part of the testnap script.

  1. Line 1 says to read everything that follows into buffer #1, until ‘XXX’ is reached.
  2. Line 2 contains the flist (in this case, it is a simple one-line flist, but typically this will contain a larger multi-line flist).
  3. The ‘XXX’ in Line 3 indicates the end of the text to put into the buffer.
  4. Line 4 just says to display the flist we have loaded into buffer 1.
  5. Line 5 says to execute the “READ_OBJ” opcode on buffer 1. This line could be replaced with a call to some opcode. For example:
    xop PCM_OP_ACT_USAGE 0 1
    This tells the system to execute opcode PCM_OP_ACT_USAGE with flag=0 on buffer 1.

4 Real-World Applications of testnap

Specific examples of scenarios in which you could use testnap are listed below. This is by no means a complete list, but it should help give you an idea of just how flexible and worthwhile testnap can be!

  1. Verifying the database connection and that all BRM components successfully started
    It’s always a good practice to check and make sure that you can run testnap after connecting to the database and bringing up all of the necessary components of BRM. If you accidentally missed starting a BRM component or made a mistake when editing a configuration file, testnap will not start successfully. If testnap starts, that’s a good indication that your system is healthy.
  2. Verifying validity of an input flist for an opcode you want to build and use in a BRM application
    Sometimes the required fields listed for input flists in the Oracle documentation don’t always line up with what BRM actually requires in the flist. This can result in unexpected errors and hours of frustration. By creating an flist in testnap and executing the opcode you want to test, you can verify that the opcode will work properly with your input.
  3. Executing a read object
    Reading an object in testnap allows you to quickly verify that any modifications, charges, or updated information associated with the object appear as expected. This is very versatile and can be used for testing account updates, billing or anything you need to check on when testing.
  4. Using an input file to perform simple actions
    Testnap allows you to create a file to store an input flist that can be passed to an opcode. For example, you can use an input file to load usage for test accounts. You can quickly verify that usage charges are appearing as expected by executing a read object on the test account and checking the output, without even needing to leave testnap! Using input files to store longer input flists is a great way to test opcodes with more complex input requirements.

As you can see, testnap is a powerful tool that can assist with validating BRM connectivity, development prototyping, testing new functionality, and more, all without writing any code! Utilize testnap to make your life easier and enhance the robustness of your tests and custom creations in BRM.


Viewing all articles
Browse latest Browse all 59

Trending Articles