Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Log into Azure and click Create a resource to access the Marketplace.



  2. Search for "Parasoft" and click Parasoft Service Virtualization in the search results.



  3. Choose a licensing plan service. In this guide, we'll select Service Virtualization On-Demand, but you can choose the BYOL Service Virtualization option if you already have the applicable license from Parasoft.



  4. Click Create and click the Basics tab.
  5. Choose your subscription option and either create a new resource group or add the new VM to an existing group.



  6. In the Instance Details section, provide a name for the VM and choose a size (DS2_V2 or better is recommended). You can leave the default settings for the rest of the instance details.

  7. Choose your authentication type and provide the necessary authentication details.



  8. Click Review + Create. For this guide, we are going to use the default settings, but you can click Next and make any additional adjustments to the VM.
  9. Review the configuration and click Create when ready. Click on a tab and make any changes if additional adjustments are required.

...

  1. Click Add System in the Environment Manager toolbar.

    Image Modified

  2. Choose Import and browse for the ParaBank.zip file.
  3. Choose AzureServer from the Target server drop-down menu.
  4. Choose localhost:2424 from the Repository server drop-down menu.
  5. Click Import.


...

  1. Log into your Azure DevOps account and click Create project.
  2. Enter Parabank as the project name and click Advanced.
  3. Verify that Git is selected as the version control system and that Agile is selected as the Work item process.



  4. Click Create.

Building the Parabank Project in Azure DevOps

  1. Choose Repo from the project sidebar and click Import.



  2. Choose Git as the Source type and enter http://github.com/parasoft/parabank.git in the Clone URL.
  3. Click Import to finish cloning the Parabank code to your project. You will be redirected to the code editor view when the import is complete.
  4. Choose Pipeline> Builds from the project sidebar and click New Pipeline.



  5. Choose Azure Repos Git and verify that the Parabank project, Parabank repository, and master branch are selected.



  6. Click Continue and apply the Maven template. The Azure DevOps Maven template adds a Pipeline task, Get sources task, and an Agent job task.



  7. Click the Maven pom.xml subtask under the Agent job task and change the value of the Goal(s) field to install.
  8. Disable the Publish to Azure Pipelines/TFS option under the JUnit Test Results section.



  9. Click the Copy Files to subtask and change the value of the Source Folder $(Build.Repository.LocalPath)/target. You should also update the Display name for consistency.
  10. Change the value in the Contents field to */.war.



  11. Choose Save & queue from the Save & queue drop-down menu.
  12. Choose Hosted from the Agent pool drop-down.
  13. (Optional) Add commit comments to document your process.
  14. Click Save & queue when ready.
  15. Click on the link in the confirmation bar to monitor the build, which will take five to 10 minutes to complete.

...

  1. Choose Browse Marketplace from the marketplace menu in Azure DevOps.
  2. Search for Parasoft Service Virtualization and click to install.

    Image Modified

  3. Return to the marketplace and repeat the process to install the Apache Tomcat Deployment artifact.

...

In this guide, we will use SSH to connect to the server. You can also click Connect on the VM home page in Azure and click the RDP tab to access a remote desktop configuration.

  1. Open a command prompt and connect to the VM:

    No Format
    ssh <VM_USER_ID>@<VM_IP>


  2. Navigate to the /usr/local/tomcat/webapps/manager/META-INF directory

    No Format
    cd /usr/local/tomcat/webapps/manager/META-INF
  3. You may not have permissions to the subdirectories under tomcat and may need to add read, write, execute access. You can change the permissions as you move through each subdirectory or recursively change the permissions.
     

    No Format
    sudo chmod -R 777 webapps

     
  4. Edit the context.xml file with a command line editor.

    No Format
    Vim context.xml
  5. Comment out the following element to enable remote access to the manager application:

    No Format
    <Context antiResourceLocking="false" privileged="true" >
    <!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
    allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> - ->
    </Context>

     

  6. Write the changes and close the file.

...

  1. Edit the tomcat-users.xml file with a command line editor


    No Format
    Vim tomcat-users.xml

     

  2. Add the following user and role configuration to the <tomcat-users> element:

    No Format
    <role rolename="manager-script"/>
    <role rolename="manager-gui"/>
    <user username="tomcat" password="tomcat" roles="manager-script,manager-gui"/>


    The username and password must both be "tomcat".
     

  3. Write the changes and close the file.
  4. You will need to restart the tomcat server. Navigate to the usr/local/tomcat/bin directory. You may need to change the permissions to enable access to the applicable subdirectories.

...

  1. After installing the plugins, return to the Parabank project and click Project settings.
  2. Click Service connections in the Pipelines section and choose Parasoft CTP from the New service connection drop-down menu.



  3. Configure the following settings when prompted:
    1. Connection name: Specify a name for the connection (e.g., ParasoftEM).
    2. Server URL: Enter the URL of your instance of CTP on Azure (see Opening CTP).
    3. Username/Password: The default username and password is admin/admin.



  4. Click OK when finished. The connection will appear in your Service connections.

...

  1. Choose Pipelines> Builds from the sidebar and click on the build created in the Building the Parabank Project in Azure DevOps section.
  2. Click the Release button and choose Empty job when prompted.



  3. (Optional) Rename the job and close the panel.
  4. Click the Tasks tab and click the add button (+) to add a task to the agent.



  5. Click the Deploy tab and add the Deploy to Apache Tomcat Server and Parasoft Service Virtualization Deploy tasks.



  6. Click on the Deploy to Apache Tomcat Server task and configure the following settings:
    1. Tomcat Server URL: <AZURE_VM_IP_ADDRESS>. Do not include the port number.
    2. Tomcat Manager Username: tomcat
    3. Password: tomcat
    4. WAR file: Browse for the location of the parabank.war file.
    5. Application Context: /
  7. Click on the Parasoft Service Virtualization Deploy task and configure the following settings:
  8. Parasoft CTP Endpoint: Choose the ParasoftEM service endpoint created in the Configuring Release Settings section.
    1. System: ParaBank (the name of the system deployed to CTP in the Creating a Virtual Machine in Azure section).
    2. Environment: Golden
    3. Instance: Negative
  9. Click Save.
  10. (Optional) By default, the configuration will be saved to the All Pipelines directory, but you can specify a subdirectory, as well as add a comment.
  11. Click OK.

...

  1. Click Create release.
  2. Verify that the correct artifact is selected and click Create.

    Image Modified

    The release will take a few minutes to complete.

...


  1. Click on the link to your release in the confirmation dialog to view the pipeline.

    Image Modified


Once the release has completed and is successful (this may take a few minutes), navigate to http://<VM_IP_ADDRESS>/parabank in your browser. The Parabank application should load
.
Image Modified

Configuring ParaBank to Use Virtualize ProxiesDeploying Virtualize to Cloud-based Microsoft Environments

Now that we've provisioned our virtual environment, we must reconfigure the Parabank application to use our proxies, which are endpoints that sit between Parabank and the virtual services it will consume. Proxies can redirect traffic between the AUT and virtual components, including web services, databases, mainframes, and other endpoints. The proxies we configure in this section will redirect Parabank's requests to our virtual services.

  1. Open the ParaBank in your browser http://<VM_IP_ADDRESS>/parabank and click the Admin page link

    Image Modified

  2. Enable the SOAP option in the Data Access Mode section
    Image Modified
  3. In In the Web Service section, enter http://<VM_IP_ADDRESS>:9080/ParabankProxy in the SOAP Endpoint field and http:// <VM_IP_ADDRESS>:9080/LoanProcessorProxy in the Loan Processor Service Endpoint field.
  4. Click Submit.

Verify that ParaBank is using the proxies:

...

The following message indicates that we've successfully configured the correct environment during our release and we have received a response from the virtual environment instance we provisioned.
Image Modified

Provisioning Other Instances

...

  1. Return to Environment Manager and open ParaBank> Golden environment.
  2. Open the instances drop-down menu to view the available instances.

    Image Modified

  3. Note the instance you want to provision and return to the release definition.
  4. Edit the Deploy task with the name of the instance you want to deploy.
  5. Remove the initial Deploy to Apache Tomcat step. This saves time and prevents you from having to reconfigure Parabank's endpoints each time Parabank redeploys.

Using the Parasoft Deploy Task in a Real Workflow

In this guide, we've executed the Deploy Parasoft task during separate release executions. This made it possible for the user to manually go into Parabank and witness the change in behavior after we deployed a certain virtual environment.

In a real use case, it's likely that a Deploy task would be utilized to create an appropriate environment for an automated test to execute. We'd then execute a Destroy task during the same workflow in order to "clean-up" the service virtualization engine after test execution. It's possible that we may iteratively provision and destroy several virtual environments in a release as we execute different categories of tests.

...

  1. Open CTP in your browser and choose Service Virtualization from the applications drop-down menu.

    Image Modified

  2. Choose Create Virtual Asset from the actions menu.

    Image Modified

  3. Rename the asset to StaticVirtualAsset and verify that Empty is selected from the Create drop-down menu.

    Image Modified

  4. Click Create Asset. The asset is just a node on the Virtualize server at this point. We'll need to add a message responder, which is a component that analyzes an incoming request and provides a response if the incoming message matches a set of criteria. Make a note of the HTTP Endpoint address.

    Image Modified

  5. Choose Add Literal Message Responder from the actions drop-down menu.

    Image Modified

  6. Rename the responder to SimpleResponder and choose XML from the format drop-down menu.

    Image Modified

  7. Copy and paste the following SOAP response into the input field.

    No Format
    <?xml version="1.0" encoding="UTF-8"?>

...

  1.  
     <soap:Envelope

...

  1.  
     xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

...

  1.  
     <soap:Body> 
     <ns2:requestLoanResponse xmlns:ns2="http://service.parabank.parasoft.com/">

...

  1.  
     <ns2:loanResponse> 
     <responseDate>2019-01-01T12:33:47.076-07:

...

  1. 00</responseDate> 
     <loanProviderName>Wealth Securities Dynamic Loans (WSDL)</

...

  1. loanProviderName> 
     <approved>false</approved> 
     <message>error.insufficient.funds.for.down.

...

  1. payment</message> 
     </ns2:

...

  1. loanResponse> 
     </ns2:

...

  1. requestLoanResponse> 
     </soap:

...

  1. Body> 
     </soap:

...

  1. Envelope>

     

  2. Click Save. This response will be sent for all requests because we have not configured the criteria for correlating specific responses to specific requests.

Configuring the AUT to Use the Virtual Asset

...

  1. Log into ParaBank and choose Request Loan.
  2. Enter any amount for the loan and down payments.
  3. Click Apply Now. The response we just created will appear.

Image Modified

Reconfiguring the Virtual Asset

  1. Return to CTP and open the SimpleResponse virtual responder.
  2. Edit the SOAP response and click Save. For example, you could change the <approved> element to true or change the name of the loan provider.
  3. Request a loan in Parabank again. Your loan will now be approved.

Image Modified

Learning More

For additional details about building virtual assets, see the "Service Virtualization" section in the CTP user guide. The online documentation, as well as API reference, is available from help menu (question).

Image Modified