-
Notifications
You must be signed in to change notification settings - Fork 0
Home
PSharp batch testing is an Addon for PSharp language.
PSharp batch tester uses Azure Batch Service to run multiple PSharp tests in parallel on the cloud and fetch the result. Using this tool you can run heavy testing in the cloud.
To run Psharp batch test, you need an Azure subscription and an Azure batch service account. To learn more about creating an Azure batch service account, view the sub-heading Azure Batch Service. Once you have that, follow the steps below:
-
Open the solution containing the PSharp project you need to test.
-
Install the Microsoft.PSharp.BatchTesting nuget from here: Microsoft.PSharp.Nuget.
-
Installing the Nuget will add two config files to the project.
- PSharpBatch.config : Contains configuration for uploading necessary files, testing in the cloud and downloading the results.
- PSharpBatchAuth.config : authentication credentials for Azure batch account and storage account.
(For more details about configuration go to: Configuring Batch Test).
-
Edit the configuration files to need and Open Nuget Package Manager Console.
-
Run the command BatchTest in Nuget Package Manager Console to start the Batch Testing.
-
/config:<filename>
: Path to PSharpBatch config file. -
/auth:<filename>
: Path to PSharpBatchAuth config file. -
/monitor
: If /psbatch flag is provided, monitor existing job. If not, run new job and monitor. -
/psbatch:<filename>
: Cache file to help monitoring existing azure job.
Sample config file can be found here
PSharpBatch.config has the following parameters:
- PoolId : Id of the virtual machine pool in Azure batch service. If it doesn't exists already, it will be created.
- NumberOfNodesInPool : Number of VMs to be added in the pool, if it is created.
- NodeOsFamily : The OS version of the VMs. Should contain .Net Framework 4.6 and above (OsFamily: >=5). For more details visit: Azure Guest OS Update Matix.
- NodeMaxConcurrentTasks : Maximum number of concurrent tasks per node (default:1).
- NodeVirtualMachineSize : Size of each virtual machine. For more details on virtual machine sizes visit: Virtual Machine Sizes
- JobDefaultId : Prefix for the Job to be created for the given tests. This will be appended by time-stamp.
- TaskDefaultId : Prefix for the tasks created under the Job. Will be appended by JobId and time-stamp.
- BlobContainerSasExpiryHours (deprecated) : Exipry time in hours for the files uploaded to storage account. After this time period, the Batch service will not be able to use the files. -1 for no expiry.
- PSharpBinariesFolderPath : Path to folder containing PSharp Binaries.
- OutputFolderPath : Path to folder where the output should be downloaded.
- TaskWaitHours : Waiting time in hours for the test to complete. Post this time, the unfinished tasks will be terminated.
- DeleteJobAfterDone : (true/false) Whether to delete the Batch-service job after it is complete.
- DeleteContainerAfterDone : (true/false) Whether to delete the storage account containers after the tests are complete.
- DeletePoolAfterDone : (true/false) Whether to delete the Azure Pool after job is complete.
- RunLocally : (true/false) If enabled, will run the test locally instead of the cloud.
-
Tests : The batch tester can run multiple tests consisting of many commands. Use the <Test> tag to add multiple tests.
- Name(attribute)(optional) - Path to the binary to be tested (.dll/.exe).
- ApplicationPath - Path to the binary to be tested (.dll/.exe).
-
Command : Tests commands to run in cloud. You can have multiple commands under a single <Test> tag.
- CommandName(attribute) : A name to command to distinguish between different tasks.
- Flags(attribute) : Flags / arguments for the test command. Requires iterations flag (/i) and parallel flag (/parallel).
Sample Auth config file can be found here
PSharpBatchAuth.config has the following parameters:
- BatchAccountName : Name of the Azure Batch Service Account.
- BatchAccountKey : Account Key for the Azure Batch Service Account.
- BatchAccountUrl : URL of the Azure Batch Service Account.
- StorageAccountName : Name of the Storage Account linked with the Azure Batch Service Account.
- StorageAccountKey : Account Key (Primary/Secondary) of the above mentioned Storage Account.
To configure Azure Batch service you need an active Azure subscription.
- Open the azure portal, and click New button.
- In the search bar search for Batch Service, and select the Batch Service option from the result.
- Click create and enter the required details. Also in this step create a new Storage Account and associate with the Batch Service before clicking create.
- After deployment is complete, you can go to the Batch account.
- The overview will give you the URL and the name of the account (Which you entered when creating the account).
- Go to the Keys tab and copy the Primary access key.
- You will need to Enter the account name, URL and the access key in PSharpBatchAuth.config.
- You can manually create the Pool from Azure Portal, or create using the PSharp Batch tester tool.