Gatling considers scenario is empty while it's not so - gatling

Gatling version 3.8.1
I've record a scenario via Gatling recorder, now I want to run it with prompt, but I'm getting "Scenario RecordedSimulation is empty" error, while it is not empty. Here are screenshots
Did I miss something to make Gatling run my scenario ?

The error message does say the simulation class doesn’t contain any code.
It’s saying the scenario named RecordedSimulation is empty, ie it doesn’t have any action chained.
The typical error is to have a missing dot to attach the scenario and its content.
Then, you might be hitting this bug if you are using the recorder: https://github.com/gatling/gatling/issues/4288

That's true, it was needed to add this dot (can't understand why Gatling missed it)

Related

Problem with tests for deploy an apex class, probably bad configuration

When I try to deploy a new apex class from a sandbox, I get the follow problems:
SFDCAccessControllerTest testAccessControl_runAs System.AssertException: Assertion Failed: Should not succeed as Survey__c is not accessible to standard user
Stack Trace: Class.SFDCAccessControllerTest.testAccessControl_runAs: line 58, column 1
Utilities_Test getInstance System.AssertException: Assertion Failed: Expected: , Actual: xxxx.
Stack Trace: Class.Utilities_Test.getInstance: line 18, column 1
I suppose it's only a bad configuration, but I'm relative new with salesforce and don't know where I can disabled both test or change permissions for Survey__c and fix the problem with the instance name withouth affect the production eviroment.
I looked for similar cases and could not find it, please can anyone guide me.
Hard to say anything without the test's source code. Do they create a dummy user with "Standard User" profile or try to query existing user? From what I remember you can't edit standard profiles, you have to clone them so I don't know how would you or colleague manage to add Read permission... But check the profile mentioned in the test -> object permissions -> Survey -> read right.
It is also possible to deploy to production without running all tests. It's bit tricky, you need to specify the classes you want to run, you could skip that unit test. But everything you pick need to pass the rules (75% coverage minimum etc). If you need to deploy to prod ASAP it could help but well, you need to eventually bite the bullet and check what exactly is wrong with the test.

babel-node error 'Reference error: window is not defined'

I was given the task to implement server-side rendering for a react application. I've followed the this tutorial: https://scotch.io/tutorials/react-on-the-server-for-beginners-build-a-universal-react-and-node-app and, afterwards, followed the exact steps on the actual application. Everything worked well with implementing the client-side rendering, but as soon as I continued with the server-side one, I got the following error: 'Reference error: window is not defined'
The problem is that the application uses scrollmagic, which is a client-side-only library (note: I added conditionals 'require' to any scrollmagic references in the code itself, but I can't find a way to bypass the module).
I thought about adding the scrollmagic library on the client-side, but as soon as I remove it I get an error from the 'require' statements.
I apologize if this is something obvious but I am new to JavaScript and have been searching for a couple of days and found nothing so far. If I can provide any additional information please let me know! Also, if you have any suggestions as to how I should handle this, I am all ears!
Best regards,
Andrew
The window object is a property of the browser/client, so you will not have access to it when executing javascript on the server. A library such as: https://www.npmjs.com/package/window-or-global can help, as well as adding conditional logic to check for the window object before executing code that depends on it.
In addition to the suggestion by #sconway to manually check for the presence of window when calling these client-side methods another method I have used in the past is to put that code in componentDidUpdate life-cycle method.
This method is guaranteed to not be called on the server, only on the client.

Selenium automation report

I am using Selenium framework for my test cases execution.
I need an instant report of test cases that are passed while the full suite is in execution currently.
For Eg: There are 100 test cases in suite and five have run of which 3 passed, 2 failed and I need these instant report while the suite is in-progress. Can you please help me with this task?
You can use ExtentReport.
You can use it to log your test steps and once its done it will generate a report to show your results.
For what your looking for, ExtentReport uses a "flush".
If you call this flush after each test step it will amend the step and create the report.
This is something I'm looking into myself at the moment, so I wouldn't consider this an answer but something I've stumbled across myself, hope it helps.
Here is how to set up ExtentReports on your project with examples - http://www.ontestautomation.com/creating-html-reports-for-your-selenium-tests-using-extentreports/
You must use it in conjunction with a test runner eg. TestNG or JUnit.
For what you are trying to achieve is slightly different to the example. You need to call a flush after every test step so it will amend to the report after the step is completed rather than when all the tests are completed. Its not something I have done before but it was explained to me like the following
Just call .flush() after every test instead of once at the end of your test run. BUT you need to make sure the ExtentReports object itself is only initialized once, instead of being reinitialized at the start of every test. For example, I used TestNG. The ExtentReports is called once using #BeforeSuite, but the .flush() is called after every test using #AfterMethod. I hope this makes sense.
The only thing that can’t be solved via code is the HTML refresh as this is outside the control of the ExtentReports library (it doesn’t know where you’ve opened the actual HTML file). But this can be taken care of by using a simple browser plugin as I said. At least for Chrome there are a lot of them, just do a Google search for ‘chrome auto refresh’.
Hope this helps. If you need anymore advice don't hesitate to contact me.

How to overcome the random failing of my selenium webdriver-java script?

Currently, i am running my selenium webdriver - java scripts, there is a strange issue which is cropping up these days. My scripts run absoulutely fine and when I re-run them.. sometimes my scripts enter the values via sendkeys() in some other fields as a result of which my entire script fails.
I dont know the real reason behind it, I know the scripts what i am running are pretty simple and straight flows.. Is this because of my application response issue? Because I have given wait commands also to tackle the same.But when I have re-run the same scripts again it enters the values in some irrelevant fields..
Note: I dont change any of my codes while rerunning it... Its more frustrating
Is this normal when you run Selenium webdriver-java scripts??
Please advise me how to tackle this issue because I am not aware to deal with this issue
You might need to figure out if your elements locators are changing dynamically each time you run and then look at your code locators to be more appropriately handling the change. Other than that I see no reason why the elements being interacted with, change randomly.

Logging PHP fatal-errors in CakePHP system

I need to log Fatal-errors of my website.
I normally check error.log and debug.log files for CakePHP errors.
But I found out that PHP related fatal errors aren't logged someplace.
It is also discussed in this thread.
I checked php.ini. IT has following lines:
log_errors = On
;error_log = filename
I don't have rights to change php.ini. I can ask admin to change this, but it seems like I need to ask him every time I need a change :) I also have concerns about performance. Whether logging errors can decrease performance or not?
So I find out that I can put following two lines inside my script to log errors and change folder or file name when I need.
ini_set("log_errors", 1);
ini_set("error_log", "/path/to/php-error.log");
So I want to know where to put this lines inside my codes? Should I put it inside AppController::beforeFilter ? Or is there a better place/solution in CakePHP 2 configuration?
this is an old thread.
in the meantime with cake 2.x errors are all logged in productive mode - so also fatal errors.
trigger one and check out your /tmp/logs/error.log
but you can easily find that out looking at the core code:
https://github.com/cakephp/cakephp/blob/master/lib/Cake/Error/ErrorHandler.php#L189
There is framework defined configuration settings. You can use the Error Handling configuration class.
Here is changing fatal error behavior link, that will help you to achieve the same.
register_shutdown_function();
http://php.net/manual/en/function.register-shutdown-function.php

Resources