Per-test sample data generation for load testing? - visual-studio

I have a set of load tests, each testing a specific section of Sharepoint site. How can I automate the generation of sample data prior to each test?
I know that load tests allow me to specify tests that are run before/after a specific virtual user's test mix, but those are meant for user-specific setup like logging on. I want to create sample data for all users.
I can put my setup code into the Team Build template, but that doesn't take into account whether the test using the sample data is in the test list being run or not. If I modify the test list, I would also need to modify the build template as well. I cannot put the setup code into a test that is run before the load test either, because load tests must be run with the .Net 4.0 framework while accessing Sharepoint's API requires 3.5.
I could rewrite my sample data generation logic with Powershell and start it from a .Net 4.0 unit test. Is it my best option or is there a more elegant way?

I think you question is more TeamBuild related than SharePoint. For short, the best way how to setup (and teardown) testdata in SharePoint is using PoSh in conjunction with the Microsoft.PowerShell.SharePoint SnapIn.
You can start your PowerShell scripts from Everywhere in TeamBuild. That's actually how I extend the default TeamBuild template. I've create a single custom build template, this template contains numerous PoSh hooks. While setting up a new project you can easily hook your scripts everywhere you need.
To be really independent from any .NET FX version you could create your sampledata using REST DataServices (ListData.svc)

Related

Create services taking reference of existing subscription

Is it possible to take the existing services in azure cloud subscription as reference and create similar services with parameters update in another subscription either by using powershell or ARM template.
We are missing few details while taking the reference details manually and then creating it using ARM templates. We wanted it to be end to end automation.
You can export the ARM template from existing resources using Export-AzureRmResourceGroup or Save-AzureRmResourceGroupDeploymentTemplate (https://azure.microsoft.com/en-us/blog/export-template/) and then redeploy that template to a new environment.
However, if you are using Export-AzureRmResourceGroup to try to dynamically create an ARM template from existing resources then the generated template will likely not be ready to automatically redeploy. There may be issues with resource dependencies, resources not getting exported correctly, template limitations, etc. It will take a fair bit of manual effort to update the generated ARM template to get it to a point where it can be correctly redeployed into another subscription.
If you are able to use Save-AzureRmResourceGroupDeploymentTemplate (ie. if your existing resources were all deployed via ARM templates with no post deployment ad-hoc changes) then the templates should be ready to deploy.
For future reference, the best solution is to always deploy all of your resources via ARM templates (or something like Terraform) where your configuration is all saved in a source repository and you are deploying via a CI/CD pipeline.

Node (maven) to deploy the application to several environments

On Jelastic, I created a node for building an application (maven), there are several identical environments (NGINX + Spring Boot), the difference is in binding to its database and configured SSL.
The task is to ensure that after building the application (* .jar), deploy at the same time go to these several environments, how to implement it?
When editing a project, it is possible to specify only one environment, multi-selection is not provided.
it`s allowed to specify just one environment
We suggest creating a few environments using one Repository branch, and run updates by API https://docs.jelastic.com/api/#!/api/environment.Vcs-method-Update pushing whole code to VCS.
It's possible to use CloudScripting technology for attaching custom logic to onAfterBuildProject event and deploying the project to additional environments after build is complete. Please check this JPS as an example of the code syntax. Most likely you will need to use DeployProject API method.

create custom build definition in VSTS using script

I am creating CI/CD pipelines in VSTS using GIT repository.
I need to use the same steps from UI while creating build definition and release configuration for projects so i want to get off this repeating manual steps and create some automation around it so I don't have to do the same steps every time.
Can anyone tell me how it is possible using scripts or any other things?
To create build definitions you have two options:
Use the new YAML builds, which allows you to specify the whole build in a YAML file instead of UI elements.
Use the Build Definition REST API create the definition locally in json form and submit it to VSTS in a single transaction. There is a nice PowerShell library called "VSTeam" which wraps the REST API functions in powershell cmd-lets.
Another thing to look at would be the use of Task Groups, these allow you to abstract away a sequence of tasks and turn those into a single reusable task.

how do I use web deploy to deploy multiple sites on localhost with different ports

I have a solution that contains multiple integration test projects and one web application project. each integration project connects to the web application when running the tests. I would like for each test project to access the website with its own database connection. I have been trying to use the web deploy functionality built into visual studio. However I have been unable to figure out what I need to add to either the deployment package that is created and/or the post build event for the test projects to declare the binding port for the website when deployed. For example, I want integration project A to create and access the website located at http://localhost:83 and integration project B to create and access the website located at http://localhost:82. Could someone please explain:
Is there anything I need to do the deployment package ?
What do I need to add to my post-build events for my integration projects when deploying the package, so that the website is created at the correct port when building the project?
Update:
I'm wanting to deploy the same site to two different locations on my machine so that I can run both sets of integration tests at the same time.
Update 2:
I have researched the web deploy tool and it allows you to specify parameters that modify what is deployed when you call it from the command line. However I have found the documentation very confusing. http://technet.microsoft.com/en-us/library/dd568968(WS.10).aspx
Update 3:
I expect these to be two different websites, each pointing to there own database. If possible I would like a single package that can be deployed using msdeploy. Which will then be called in a post build event from each of the integration test projects. I would like to specify the connection string and deployment location from the post build script of the integration project.
you can try with webdev.server included in visual studio. VisualStudio use this for start a webserver when you debug. With this you can start a webserver in the desire port (if the port is not used currently).
I made a bat file for change some options.
check it.
::Begin of bat file
cd C:\Program Files\Common Files\microsoft shared\DevServer\10.0\
WebDev.WebServer40.exe /port:80 /path:"C:\PATHTOYOURWEBPROJECT" /vpath:"/NAMEOFYOURWEBPROJECT"
::End of bat file
You can acces in: http://localhost:80
I use the webserver40, but if you don't have net.4 or vs2010 you can try to find webserver[ xx version].exe
I hope that this will be helpful, and sorry for my broken english.
First off, you're approaching this the wrong way.
> I would like for each test project to access the website with its
own database connection.
Who is creating the DB connection? Your web site or the test project? For rest of your question to make sense, I presume its the web site (otherwise, Project A and Project B cannot share a connection out of the box).
If your website is making the connection, unless you're caching or having a static connection, there will be a new connection made as each request runs your your site on a new thread. Another simpler alternative is to take a query param and initiate a new connection based on that. If you seed it off the caller, you can also use it for more detailed logging.
Web Deployment projects are meant for deploying to integration servers, so that means you cannot access them by http://localhost... but the full FQDN of the server.
Most importantly, http://localhost:82/myApp and http://localhost:83/myApp are two different sites (unless you redirect from one of them to another one which in itself can cause additional issues) running the same codebase.
Having said that, you would then need to deploy your website twice and then all you need is to change the config/settings entry in Project A and B to point to these to different sites.
Hope this makes sense.
You can define virtual host configuration.
Refer this guide for more information.
http://docs.jboss.org/jbossas/guides/webguide/r2/en/html/ch07.html

How to deal with database initialization?

As also described here, I'm trying to determine the best way to initialize and update my application's database. I use EclipseLink-JPA2. I distribute a NetBeans platform application.
Considered options:
use create-tables ddl-generation:
The problem with this is that everytime the application runs it will throw exceptions, failing to create the tables. It will be useful only at setup time. This would be similar to placing checking code in the module restored() method.
include the database with the application distribution: the ddl-generation strategy becomes do nothing. I could still use the JPA (at development time) to generate the database files (embedded Java DB).
The best solution would be for the installer/setup (first-time) to call initializing code that creates the database. This precisely what I do with JWS in here. But I don't know how to do that without JWS. A script/jar executed by the installer?
Distribute your NetBeans Platform application via JWS.
It seems like you already have this problem sorted out with JWS, so just use that solution to deploy your NetBeans platform app.
EDIT
An alternative approach would be to use a Module Installer that checks for the existence of a config file. If the file exists then the application has been run before and the setup is not required. If the file doesn't exist then run your setup steps.
Have a look at this tutorial, they're using a module installer to create a login dialog.

Resources