I cannot get VisualPHPUnit to run my tests - phpunit

I installed VisualPHPUnit as described here. I'm using XAMPP.
define('PEAR_PATH', 'c:\xampp\php\pear');
define('TEST_DIRECTORY', 'C:\xampp\htdocs\visualphpunit\tests');
When I run, I see no text, only nicely formatted blanks. Haven't been find-by-google anyone else who has reported an empty rendering of the VisualPHPUnit screen.
Left side shows "
VisualPHPUnit
Tests-------------
Options ------------
Archives -----------
Graphs -------------
And the right side is a big blank.
Running phpunit from command-line works fine.
C:\xampp\htdocs>phpunit visualphpunit\tests
PHPUnit 3.6.10 by Sebastian Bergmann.
..foo { breaks: this } barI.some stuffFsome stuffES
Time: 0 seconds, Memory: 3.25Mb
There was 1 error:
C:\xampp\htdocs\visualphpunit\tests\PUTest.php:8
C:\xampp\php\phpunit:46
FAILURES!
Tests: 7, Assertions: 5, Failures: 1, Errors: 1, Incomplete: 1, Skipped: 1.
C:\xampp\htdocs>

NSinopoli (developer of VisualPHPUnit) here.
It's strongly recommended to report any bugs/issues with VPU on the project's issue tracker.
That said, #edorian's diagnosis is incorrect - having output in your tests does not break VPU. (It's actually collected and rendered below the results of the test that contains it.)
"When I run, I see no text, only nicely formatted blanks" - did you select any tests in the file selector before clicking "Run Tests"? Running VPU without selecting any tests will get you the blanks you've described. If that's not the case, are you running the tests with any "Options" selected? If so, there could be a configuration issue which is preventing proper rendering of the results.

You have output in your tests. As far as i remember this breaks VisualPHPUnit because it damages the json log file used by VisualPHPUnit.
Remove the output from your tests and it should work

Related

Log.html only showing the passed test cases when using the "pabot --testlevelsplit Tests/demo.robot" command

I am trying to learn robot & facing two confusions(m a total noob) .Pretty sure I am making a rookie mistake & would appreciate some help .
1)Every time I execute the tests using the "pabot --testlevelsplit Tests/demo.robot" command, the log.html doesn't show the failed test case (in this case: Fill the login form and select "Teacher" from the User option) even though the terminal output shows it as failed.
The same test case however passes when I run them individually and log.html shows 3 passed test cases.
code[Log showing only the 2 passed cases
terminal showing only 2 passed test cases
all the test cases passed and showing up in logs when executed using the ".robot /Test/demo.robot" command

system2("bash", "ls") -> cannot execute binary file

Anyone got an idea why
system2("bash", "ls")
would result in (both in R-Gui and RStudio Console)
/usr/bin/ls: /usr/bin/ls: cannot execute binary file
while other shells work w/o issues (see example below) and the "bash" in the RStudio Terminal also works w/o problems. AND if there is a remedy for that?
Working system2 example:
system2("powershell", "dir")
Running R-3.6.3 on Windows 10 here ... with "Git bash" executing as "bash".
PS: just in case someone wonders - I also tried the full path ie /usr/bin/ls -> same result
Ok - this does the trick
system2("bash", input = "ls")
so instead of args = ... as with the powershell command one needs (or more interestingly sometimes 'can') use the input = ... parameter with bash
OR as mentioned in the comments by #oguzismail this will also work
system2("bash", "-c ls")
as well as pointed out by #Christoph
system2("ls")
also works sometimes (ie in some RStudio[?] setups it will not return results in some it will).
But I have come to notice that different combinations of R-versions with different RStudio versions [or more probably Locales] will not always behave consistently of course also depending on the availability of bash commands like ls (more generally /usr/bin) being on the PATH or not.
So choose what suits u best!

RobotFrameWork: how can I stop lines temporary from running?

RobotFrameWork:
by means of this Symbol: # it is possible to comment lines
But I don't want to comment lines but skip temporary (for test purposes of the test) from running...
How dan I do that?
(I don't want te mix the lines that have to stay commented with the lines that are temp. comment to not run in the run).
I would pass a flag to robot framework which can be used on lines you want to temporarily stop executing:
robot --variable TEMP_STOP:True smoke_tests.robot
Then in your code add the following snippet on lines you want to skip temporarily for that run:
Run Keyword If '${TEMP_STOP}'!='True' Log Logs If not True
Also ensure there is a default value for the variable in your suite otherwise you will get and error. Thanks for mentioning this in the comments #TodorMinakov
*** Variables ***
${TEMP_STOP} False
To re-enable those lines then you can just pass:
robot --variable TEMP_STOP:False smoke_tests.robot
In all fairness this should be solved through commenting your code by selecting the entire set of code and commenting that and reverse-commenting that same section. This will 'double comment' existing comments and when you reverse the comment on the entire block this will remain commented. In the below example I use RED, but any IDE with support for Robot Framework Script will behave similarly.
Code:
*** Test Cases ***
My Test Case
Log To Console Uncommented Start Keyword
# Log To Console Permanent Commented Keyword
Log To Console Temporary Commented Keyword
# Log To Console Permanent Commented Keyword
Log To Console Temporary Commented Keyword
Log To Console Uncommented End Keyword
Then we comment the section we want, notice the double comments:
Now we reverse the same section by selecting it and perform the toggle (un)comment:

Qt error is printed on the console; how to see where it originates from?

I'm getting this on the console in a QML app:
QFont::setPointSizeF: Point size <= 0 (0.000000), must be greater than 0
The app is not crashing so I can't use the debugger to get a backtrace for the exception. How do I see where the error originates from?
If you know the function the warning occurs in (in this case, QFont::setPointSizeF()), you can put a breakpoint there. Following the stack trace will lead you to the code that calls that function.
If the warning doesn't include the name of the function and you have the source code available, use git grep with part of the warning to get an idea of where it comes from. This approach can be a bit of trial and error, as the code may span more than one line, etc, and so you might have to try different parts of the string.
If the warning doesn't include the name of the function, you don't have the source code available and/or you don't like the previous approach, use the QT_MESSAGE_PATTERN environment variable:
QT_MESSAGE_PATTERN="%{function}: %{message}"
For the full list of variables at your disposal, see the qSetMessagePattern() docs:
%{appname} - QCoreApplication::applicationName()
%{category} - Logging category
%{file} - Path to source file
%{function} - Function
%{line} - Line in source file
%{message} - The actual message
%{pid} - QCoreApplication::applicationPid()
%{threadid} - The system-wide ID of current thread (if it can be obtained)
%{qthreadptr} - A pointer to the current QThread (result of QThread::currentThread())
%{type} - "debug", "warning", "critical" or "fatal"
%{time process} - time of the message, in seconds since the process started (the token "process" is literal)
%{time boot} - the time of the message, in seconds since the system boot if that can be determined (the token "boot" is literal). If the time since boot could not be obtained, the output is indeterminate (see QElapsedTimer::msecsSinceReference()).
%{time [format]} - system time when the message occurred, formatted by passing the format to QDateTime::toString(). If the format is not specified, the format of Qt::ISODate is used.
%{backtrace [depth=N] [separator="..."]} - A backtrace with the number of frames specified by the optional depth parameter (defaults to 5), and separated by the optional separator parameter (defaults to "|"). This expansion is available only on some platforms (currently only platfoms using glibc). Names are only known for exported functions. If you want to see the name of every function in your application, use QMAKE_LFLAGS += -rdynamic. When reading backtraces, take into account that frames might be missing due to inlining or tail call optimization.
On an unrelated note, the %{time [format]} placeholder is quite useful to quickly "profile" code by qDebug()ing before and after it.
I think you can use qInstallMessageHandler (Qt5) or qInstallMsgHandler (Qt4) to specify a callback which will intercept all qDebug() / qInfo() / etc. messages (example code is in the link). Then you can just add a breakpoint in this callback function and get a nice callstack.
Aside from the obvious, searching your code for calls to setPointSize[F], you can try the following depending on your environment (which you didn't disclose):
If you have the debugging symbols of the Qt libs installed and are using a decent debugger, you can set a conditional breakpoint on the first line in QFont::setPointSizeF() with the condition set to pointSize <= 0. Even if conditional breakpoints don't work you should still be able to set one and step through every call until you've found the culprit.
On Linux there's the tool ltrace which displays all calls of a binary into shared libs, and I suppose there's something similar in the M$ VS toolbox. You can grep the output for calls to setPointSize directly, but of course this won't work for calls within the lib itself (which I guess could be the case when it handles the QML internally).

Issue in executing a batch file using PeopleCode in Application engine program

I want to execute a batch file using People code in Application Engine Program. But The program have an issue returning Exec code as a non zero value (Value - 1).
Below is people code snippet below.
Global File &FileLog;
Global string &LogFileName, &Servername, &commandline;
Local string &Footer;
If &Servername = "PSNT" Then
&ScriptName = "D: && D:\psoft\PT854\appserv\prcs\RNBatchFile.bat";
End-If;
&commandline = &ScriptName;
/* Need to commit work or Exec will fail */
CommitWork();
&ExitCode = Exec("cmd.exe /c " | &commandline, %Exec_Synchronous + %FilePath_Absolute);
If &ExitCode <> 0 Then
MessageBox(0, "", 0, 0, ("Batch File Call Failed! Exit code returned by script was " | &ExitCode));
End-If;
Any help how to resolve this issue.
Best bet is to do a trace of the execution.
Thoughts:
Can you log on the the process scheduler you are running this on and execute the script OK?
Is the AE being scheduled or called at run-time?
You should not need to change directory as you are using a fully qualified path to the script.
you should not need to call "cmd /c" as this will create an additional shell for you application to run within, making debuging harder, etc.
Run a trace, and drop us the output. :) HTH
What about changing the working directory to D: inside of the script instead? You are invoking two commands and I'm wondering what the shell is returning to exec. I'm assuming you wrote your script to give the appropriate return code and that isn't the problem.
I couldn't tell from the question text, but are you looking for a negative result, such as -1? I think return codes are usually positive. 0 for success, some other positive number for failure. Negative numbers may be acceptable, but am wondering if Exec doesn't like negative numbers?
Perhaps the PeopleCode ChDir function still works as an alternative to two commands in one line? I haven't tried it for a LONG time.
Another alternative that gives you significant control over the process is to use java.lang.Runtime.exec from PeopleCode: http://jjmpsj.blogspot.com/2010/02/exec-processes-while-controlling-stdin.html.

Resources