Azure - Use of dynamically generated Auth-token in Load Test requests - azure-devops

I'm quite new to Azure/AzureDevOps and its LoadTest app.
I need to execute a Load Test for a scenario where I login as a user and execute a few requests while logged in.
The original request is returning auth-token in its Response, that auth-token is used as one of the parameters for the Header in all other sequential Requests.
What I cannot figure out (nor find on the Internet) is to:
1. How to get the auth-token in the 1st Response;
2. How to use this token (dynamically) in all other Requests in the Load Test.
Any help is greatly appreciated.

I guess you intended to run a web test against your web application.
have you created your load test project with Visual Studio?
As for getting the auth-token and using it in other requests,I don't think it is achievable with azure devops load test app.
I believe it should be done in your web test code.
You can create your web test which introduced in this document or write your test in code with selenium or other tools. Add add the web test to a load test project. To deal with the dynamic parameters which cannot be detected by your web request in your test,you can check this document.
After you have created your load test project. You can upload your load test to azure devops load test shown as below pic.

Related

Can I get the Swagger interface to appear on a deployed Azure web API?

When one creates an ASP.NET Core Web API in Visual Studio 2022, and tests it locally, one gets a convenient Swagger page built upon an OpenAPI definition, to test all HTTP endpoints.
However, when deployed and trying to access {path-to-api}/swagger, it returns a 404 Not Found error, even while on localhost, when both the API and the database is sitting on my own machine. Even if the database is in the Azure cloud, for that matter, it also works, if I put the Azure SQL Database connection string into appsettings.json.
So is there a way to achieve this, preferably without too much hassle? Or am I wrong in wanting this, do developers mostly test their APIs locally? Because I want the Swagger API online only for testing.
The problem is getting and using the swagger functionality into the cloud. Is it possible and good practice?
If you look at the startup, you will notice that the swagger is only loaded during a development session via an if check. Commenting that out, or expanding it based on evironment, will allow a published version to generate the page on the target host.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
I generally do that for first publishes or to Dev/Test environments to see it running. Once it is not needed, I un-comment it back in.
Also it may be actually viable (turned on) in Dev or UAT server because one is also publishing the open api it to APIM (Azure api manager), which takes the api and generates its own development environment; away from an initial publish.
Also once published, it is not the default page, one still has to path to it such as .../swagger/index.html.
I'm aborting this mission to deploy the Swagger interface to Azure along with my API. It's bad security practice to make the HTTP request methods so visually available to all. So the answer to my question do developers mostly test their APIs locally, is apparently yes.
I wondered if I should remove the question, but I would like to make it still stand, in case anyone else is contemplating about doing the same thing - exposing an API online with the Swagger UI.

how to connect and deploy a flutter app to "real server" base on .netcore+iis+sqlserver

I have a project to make a website and application, and i did it by .net core and sql server and deploy it on iis and finally real server and special domain. Also i did my flutter app and tested it by url on local host ('http://192.168.1.110/project_Name/Controller/method_Name') to get connect with my database and it answered currectly,
But now i have a problem with my url to connect real server and create data on sql on server side(i can not find any special pattern to write url with domain-server-port and ...).
i dont know how to do it ,for example Should i add my fluttr app by iis or just change (new type of)url to get connection with my website backend ??
all of the sources learn about localhost.
could some one answer me about it or introduce appropriate source to guide??
One way to do that is to serve the flutter app as static files, you can achieve that by copying the output of flutter build web to the wwwroot folder of the ASP.Net core project should look something like this :
And then you need to serve it by adding the static files middleware in your request pipeline in your Startup.cs Configure method using the app.UseStaticFiles();
You should then access your flutter web application following the URL :
https://yourdomainname/index.html

Is there a way to import a Bamboo Spec file via the REST API?

I currently try to automate the process of creating a new Bamboo linked repository and start the scan. I've already looked over the documentation of the REST API, tried to generate a new plan and enabling a scan, but that didn't work.
I also tried the Java Maven Package from Atlassian, but that needs user credentials as an authentication method, whilst I need to authenticate via a Security token. There is a link to an API in that Maven Package, which I tried to send a request to with the yaml code, but it always responds with the status code 500 and a Java Stacktrace. It's probably due to a wrong request body, but I can't figure out, how to include the yaml content the same way, as the maven package.
Is there a way to create a linked repository via the REST API?
Thanks in advance!
Is there a way to create a linked repository via the REST API?
No and there won't ever be one because they're deprecating the Bamboo server in favour of their cloud-based alternative (which is based on a totally different API). See https://jira.atlassian.com/browse/BAM-18453
Java Maven Package from Atlassian
What package is that? Based on what I said earlier the only way for you to programmatically create a linked repo is to mimic the browser POST request to updateLinkedRepository.action. That means that you'll need to login first to get a JSESSIONID cookie (xsrf token can be disabled, see https://confluence.atlassian.com/bamkb/rest-api-calls-fail-due-to-missing-xsrf-token-899447048.html#RESTAPIcallsfailduetoMissingXSRFToken-Workaround). Ping me if you need help, I still have ansible code for the login part.

Blazor Webassembly project calling REST API

I created a Blazor WebAssembly application and tried calling an external weather API for testing purposes. I put an XUnit test project in front of the WeatherService class that I created and the test execute successfully giving me the data.
When I run it from a Blazor component I see in the F12 developer tools console that the REST call executed.
But I see a bunch of errors in the Console.
It does not load the data on the page as expected. Has anyone faced this situation. I am running the latest template of the Blazor App built using VS 2019.
Also my Blazor Web Assembly app is not hitting any breakpoints, so I dont really know at what stage it is breaking.

How does data driven unit test works to retrieve data from VSTS work item?

I saw some test code using data driven test approach to read the test data from VSTS work item with following like code:
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.TestCase", "https://myaccount.visualstudio.com/DefaultCollection;XXX", "11543012", DataAccessMethod.Sequential)]
I tried this approach also in my code, but got following like error:
The unit test adapter failed to connect to the data source or to read the data. Error details: TF26198: The work item does not exist, or you do not have permission to access it.
I am wondering what is the underlying mechanism of Data Source connection to VSTS work item? How does my code connect to VSTS work item? What credential it uses to access work item?
It uses cache credential of team explorer. Log on test/build with the same account of test agent/build agent, then connect to your VSTS through Team Explorer, then queue build/release to do test.
Note, if you are using Visual Studio Test task, the test is running on build agent, if you are using Run Functional Test, the test is running on test agent.