Categories
Uncategorized

Changing ScriptLink API Behavior Based on Parameters

One of the decisions we have to make when designing our ScriptLink solutions is “how many endpoints (web services) do we want to support?” If we do one endpoint per action then we can end up with dozens if not hundreds of different WSDLs to import and manage. A centralized “controller” means one endpoint to send every request through.

I recommend the latter design if for only one reason. One endpoint makes it easier to redirect your testing myAvatar server (“UAT”) to your testing ScriptLink endpoint. This is especially important after your routine LIVE-to-UAT copy. This means one WSDL to import. It also means there’s a higher likelihood of creating and maintaining a test ScriptLink server avoiding testing in production.

For this design to work we need a way to modify the behavior of our endpoint based on the specific request. Responding “Hello, World!” will be of little use on most forms. Last week, we created a command to run when the API is called. Today, we are going to create a command selector that choose which command to run based on the parameter provided.

Categories
Uncategorized

Unit Testing Your ScriptLink API with C# and MSTest

In my previous articles, we setup SoapUI and Postman to test the responses to our submissions. While this is an important testing method, it is time consuming and can be difficult to test all the various scenarios. This where Unit Testing comes in. With Unit Tests we can test our code for regressions in seconds (or milliseconds) and as we write our code.

Unfortunately, the design we have followed so far does not support Unit Testing, so we will have to make some changes. The best practice is to write your test, then write your code (make your code changes). So that is what we are going to do.

Categories
Uncategorized

Testing Your ScriptLink API with SoapUI

Welcome back to my series on getting started with myAvatar ScriptLink. Today, we are looking at testing. As tempting as it may be. We should not test our ScriptLink APIs in production. We want to test our code before it impacts the users. In our first test, we will set up SoapUI to send a request to our development environment and verify the response.

When we left off, we had created our first Hello World ScriptLink API in .NET using C# and Visual Basic. If we created them correctly, the we should be able to call the RunScript method with the HelloWorld parameter and receive an Error Code 3 with the ErrorMsg “Hello, World!” Let’s test that.