how to assert a value from another file in gatling - scala

Im new to gatling tool trying to assert an value from the response and the same response value is been saved in another file now to assert the value.
.check(jsonPath("$.id").is(TestParameters.locationId))
TestParameters is the file where I had saved the value.

The most elegant way to deliver variables is a Feeder.
Storing variables in a file isn't a very nice solution. You can use ordinary variables for this purpose. Nevertheless, if you so want to use the file, then you just need to write a function that will read from the file and write to the feeder.

Related

give an initial value to the type File in flutter

hi every one I need to give an initial value to the type File in flutter language such as this var File _profileImage = ; what I should put after the = . I don't want use this format File? _profileImage;
A File object doesn't do anything until you perform an operation on it (such as trying to open, read from, or write to the underlying file on the filesystem). Therefore, if you really want, you could do var _profileImage = File(''); and check _profileImage.path.isNotEmpty everywhere later. (For POSIX systems, you also could consider File('/dev/null'), which wouldn't fail if you attempt to read from or write to it.)
However, that is arguably not any better than using File? with a null default. Using a File? would allow Dart's type system to catch any places where you neglect to check for that bogus initial value at compile-time.

How do I "capture" and store the complex output of a Flutter function as code so I can write unit tests for it?

First of all, apologies if this is a stupid question. I'm new to unit tests so I'm struggling a bit here.
I'm working on an app that queries an API, receives a JSON response and then processes that response to produce a series of complex data structures. Many of these data structures are daily time series, which means each of my functions produces a list (List<Datapoint>) containing hundreds of datapoint objects.
What I'm trying to test is that, for a given API response, each function produces the output it should.
For the input of each test I have already grabbed a sample, real JSON response from the API, and I've stored it inside a test_data folder within my root test folder.
However, for the expect part... how can I obtain a sample output from my function and store it somewhere in my test_data folder?
It would be straightforward if the output of my function were a string, but in this case we're talking about a list with hundreds of custom objects containing different values inside them. The only way to create those objects is through the function itself.
I tried running the debugger to check the value of the output at runtime, which I can do... but that doesn't help me copy it or store it anywhere as code.
Should I try to print the full contents of the output to a string at runtime and store that string? I don't think this would work, as all I see in the console are a bunch of Instance Of when I do functionOutput.toString()... I would probably need to recursively print each of the variables inside those objects.
Please tell me I'm being stupid and there's a simpler way to do this :)

Collect internal variables of nested functions in matlab

I have a project consisting of multiple nested functions.
For debugging purpose I want to save all internal variables in one way or another, in order to display figures, replay parts of code etc...
I also want to keep this as transparent as possible regarding calculation time.
My first thought was to create a global variable, and store programmatically at the end of each function the inputs and outputs inside the variable as a structure :
globalVariable.nameOfParentfunction_NameOfFunction.nameInput1 = valueInput1;
globalVariable.nameOfParentfunction_NameOfFunction.nameInput2 = valueInput2;
...
globalVariable.nameOfParentfunction_NameOfFunction.nameOutput1 = valueOutput1;
...
Is it possible to use some kind of reflection to get the name and value of inputs/outputs without necessarily parse the file where the function is written?
I found a good but maybe outdated topic about parsing
How do I collect internal signals?
The simple solution is to use save, which will save all variables in the current workspace (the function’s context) to file.
If you want to keep the values in memory, not in a file, you can use names = who to get a list of all variables defined in the current workspace, then use val = eval(names{i}) to get the value of the variable called name{i}.
I would recommend putting all of that in a separate function, which you can call from any other function to store its variables, to avoid repeating code. This function would use evalin('caller',…) to get names and values of variables in the workspace of the calling function.
Note that using eval or evalin prevents MATLAB from optimizing code using its JIT. They also are dangerous to use, since they can execute arbitrary code, however in this case you control what is being executed so that is no a concern.

How to import a header file to load constant values in Simulink? (for generable code)

I'm developing a Simulink model with many constants.
I'm trying to:
Avoid hardcoding every constant in the model and have something unreadable.
Be able to know what that 9.73288483... constant in the middle of my model stands for.
I wanted to add all my constants to a header file to have them as global constants (/including the header file everywhere) so that I could directly refer to their name instead of the value and it would also simplify my model.
Another reason for me to use a header file is that I will then generate my model in C using Simulink coder, and I really want to have that header file to have a clean generated code
I've seen people in here referring to the existence of such function.
So I've been wondering if anyone here could help me out?
Then I could also apply it to replace my functions parameters by global constants in another header file which would let me simply load a different "parameters_values.h" file when I want to change the conditions of my simulation easily.
You can specify under "file->model properties" callback functions

Is there a way to access user defined variables in vsfi file?

Summary: Is there a way to access user defined variables in vsfi file?
After my simulation is done, in a vsif file, I kick off a post simulation script that will launch Matlab to analyze the output of the DUT.
In order to analyze the data in Matlab I need to compare expected values with observed values. Some of these expected values are defined in my test.e. Is there a way to pass a simulation run variable ( in test.e) to my vsif file?
Thank you
I don't think what you want is possible, as Specman and Vmanager are different tools. Since you're going the post-processing way, you can just dump a text file from your e code that your Matlab script can read.
The .vsif file is descriptive and read at the beginning of the session, so you can't pass information from a task to another task.
I would suggest the same as Tudor.