My testcase crashes with the following error:
$this->open("/en");
$this->type("id=LoginForm_username", "seleniumfree");
$this->type("id=LoginForm_password", "seleniumfree");
$this->click("name=login");
$this->waitForPageToLoad("30000");
$this->click("link=Calendar");
$this->waitForPageToLoad("30000");
$this->click("link=Add to agenda");
$this->type("id=UserAgenda_date", "2013-10-10");
$this->select("id=UserAgenda_time", "label=01:00");
$note = $this->getEval("Math.floor(Math.random()*1000)").':note';
$this->type("id=UserAgenda_note", $note);
$this->click("name=yt0");
sleep(5);
try { //also tried with integer
$this->assertEquals("2", $this->getXpathCount("//input[#value='"+ $note + "']"));
} catch (PHPUnit_Framework_AssertionFailedError $e) {
array_push($this->verificationErrors, $e->toString());
}
Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/':
ERROR: Command execution failure. Please search the user group at https://groups.google.com/forum/#!forum/selenium-users for error details from the log window.
The error message is: The expression cannot be converted to return the specified type.
In firefox IDE, playing the test runs fine.Is there another way I can count the inputs by value?
Related
I just involved the new project for API test for our service by using Gatling. At this point, I want to search query, below is the code:
def chnSendToRender(testData: FeederBuilderBase[String]): ChainBuilder = {
feed(testData)
exec(api.AdvanceSearch.searchAsset(s"{\"all\":[{\"all:aggregate:text\":{\"contains\":\"#{edlAssetId}_Rendered\"}}]}", "#{authToken}")
.check(status.is(200).saveAs("searchStatus"))
.check(jsonPath("$..asset:id").findAll.optional.saveAs("renderedAssetList"))
)
.doIf(session => session("searchStatus").as[Int] == 200) {
exec { session =>
printConsoleLog("Rendered Asset ID List: " + session("renderedAssetList").as[String], "INFO")
session
}
}
}
I declared the feeder already in the simulation scala file:
class GVRERenderEditor_new extends Simulation {
private val edlToRender = csv("data/render/edl_asset_ids.csv").queue
private val chnPostRender = components.notifications.notice.JobsPolling_new.chnSendToRender(edlToRender)
private val scnSendEDLForRender = scenario("Search Post Render")
.exitBlockOnFail(exec(preSimAuth))
.exec(chnPostRender)
setUp(
scnSendEDLForRender.inject(atOnceUsers(1)).protocols(httpProtocol)
)
.maxDuration(sessionDuration.seconds)
.assertions(global.successfulRequests.percent.is(100))
}
But Gatling test failed to run, showing this error: Exception in thread "main" java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated
If I hardcode the #{edlAssetId} (put the real edlAssetId in that query), I will get result. I think I passed the parameter wrongly in this case. I've tried to print the output in console log but no luck. What's wrong with this code? I would appreciate your help. Thanks!
feed(testData)
exec(api.AdvanceSearch.searchAsset(s"{\"all\":[{\"all:aggregate:text\":{\"contains\":\"#{edlAssetId}_Rendered\"}}]}", "#{authToken}")
.check(status.is(200).saveAs("searchStatus"))
.check(jsonPath("$..asset:id").findAll.optional.saveAs("renderedAssetList"))
)
You're missing a . (dot) before the exec to attach it to the feed.
As a result, your method is returning the last instruction, ie the exec only.
I know that this question is duplicate one. But I am searching for the result from yesterday. I didn't got any solution for that..
I am using Selenium Webdriver 2.47.1 & TestNG for automation. In my automation script I have 12 set of tests & I am using TestNG Assert method to compare Expected Result & Actual Result. My code format is given below...
#Test(priority = 6)
public void TestingeNote1() {
cd.switchTo().frame("RTop");
cd.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
String TesteNote1 = cd.findElement(By.xpath("//table/tbody/tr[2]/td[5]")).getText();
StringBuffer object1 = new StringBuffer(TesteNote1);
String ActeNote1 = object1.substring(108);
String ExpeNote1 = ex.getExcelValue(scenarioName, 75, 4);
try {
Assert.assertEquals(ExpeNote1, ActeNote1);
ex.setExcelValue(scenarioName, 75, 8, "PASSED");
}
catch(Exception e) {
ex.setExcelValue(scenarioName, 75, 8, "FAILED");
}
cd.switchTo().defaultContent();
}
Execution of test script stops once assertion got failed. I want to continue the execution after assertion fail also. I have used Verify() also, It just gives the verify result as passed. But the above test result is Failed one.
I'd recommend using a try/finally block.
.
.
.
try {
//use IF condition to match Strings (ExpeNote1, ActeNote1)are equal
ex.setExcelValue(scenarioName, 75, 8, "PASSED");
}
catch(Exception e)
{ ex.setExcelValue(scenarioName, 75, 8, "FAILED");}
finally { cd.switchTo().defaultContent();}
Use try catch block with proper exception catcher. For example when you try to catch a normal exception use exception in the catch block, if the element is not present in the DOM then use NoSuchElementException etc... In your case catch the exception that you are getting in your error console. Here's how -
try {
Assert.assertEquals(ExpeNote1, ActeNote1);
ex.setExcelValue(scenarioName, 75, 8, "PASSED");
}
catch(AssertionError e) {
ex.setExcelValue(scenarioName, 75, 8, "FAILED");
}
Your execution stops because you are not catching the proper exception that your assert statement throws. I guess you are getting an AssertionError, if not replace the exception type you get from your code above. Hope this helps.
Use soft asserts. It will continue test even after one assertion failed.
SoftAssert softAssert = new SoftAssert();
String ActualErrorMEssage = firstNameerrorXpath.getText;
String ActualErrorMEssage2 = secondNameNameerrorXpath.getText;
softAssert.assertEquals(ActualErrorMEssage,ExpectedErrorMEssage);
softAssert.assertEquals(ActualErrorMEssage2,ExpectedErrorMEssage);
softAssert.assertAll();
#!/usr/bin/tclsh
proc test {} {
aaa
}
test
When I run this script I get error message:
invalid command name "aaa"
while executing
"aaa"
(procedure "test" line 2)
invoked from within
"test"
(file "./a.tcl" line 7)
If I run test command in catch I get only first line of error message.
#!/usr/bin/tclsh
proc test {} {
aaa
}
catch test msg
puts $msg
This prints:
invalid command name "aaa"
Is it possible to get full error message (file, line, procedure) in catch command? My program has many files and by getting just one line of error message it is difficult to find from where is it.
The short answer is to look at the value of errorInfo which will contain the stack trace.
The more complete answer is to look at the catch and the return manual pages and make use of the -optionsVarName parameter to the catch statement to collect the more detailed information provided. The return manual page gives some information on using this. But a rough example from an interactive session:
% proc a {} { catch {funky} err detail; return $detail }
% a
-code 1 -level 0 -errorstack {INNER {invokeStk1 funky} CALL a} -errorcode NONE -errorinfo {invalid command name "funky"
while executing
"funky"} -errorline 1
%
The detail variable is a dictionary, so use dict get $detail -errorinfo to get that particular item.
I've been attempting for the last couple of days to update unidata using sample code as a basis using .NET without success. I can read the database successfully and view the raw data within visual studio. The error reported back is a out of range error. The program is attempting to update the unit price of a purchase order.
Error:
{" Error on Socket Receive. Index was outside the bounds of the array.POD"}
[IBMU2.UODOTNET.UniFileException]: {" Error on Socket Receive. Index was outside the bounds of the array.POD"}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
HResult: -2146232832
InnerException: null
Message: " Error on Socket Receive. Index was outside the bounds of the array.POD"
Source: "UniFile Class"
StackTrace: " at IBMU2.UODOTNET.UniFile.Write()\r\n at IBMU2.UODOTNET.UniFile.Write(String aRecordID, UniDynArray aRecordData)\r\n at ReadXlsToUnix.Form1.TestUpdate(String PO_LINE_SHIP, String price) in c:\Users\xxx\Documents\Visual Studio 2013\Projects\ReadXlsToUnix\ReadXlsToUnix\Form1.cs:line 330"
TargetSite: {Void Write()}
failing Test Code is:
private void TestUpdate(string PO_LINE_SHIP,string price)
{
UniFile pod =null;
UniSession uniSession =null;
//connection string
uniSession = UniObjects.OpenSession("unixMachine", "userid", Properties.Settings.Default.PWD, "TRAIN", "udcs");
//open file
pod = uniSession.CreateUniFile("POD");
//read data
pod.Read(PO_LINE_SHIP);
//locking strategy
pod.UniFileLockStrategy = 1;
pod.UniFileReleaseStrategy = 1;
if (pod.RecordID == ""){
pod.UnlockRecord();
}
//replace existing value with one entered by user
pod.Record.Replace(4, (string)uniSession.Iconv(price, "MD4"));
try
{
pod.Write(pod.RecordID,pod.Record); //RecordId and Record both show correctly hover/immediate window
//pod.Write() fails with same message
}
catch (Exception err)
{
MessageBox.Show("Error" + err);
}
pod.Close();
UniObjects.CloseSession(uniSession);
}
}
Running on HP UX 11.31 unidata 7.2 and using UODOTNET.dll 2.2.3.7377
Any help greatly appreciated.
This is the write record version and have also tried writefield functionality with same error.
Rajan - thanks for the update and link. I have tried unsuccessfully to read/update my unidata tables using the U2 Toolkit. I can however read/update a file I have created within the same account. Does this mean there is a missing entry somewhere VOC, DICT for example.
What is the syntax for if-else-if statements in Sahi script? The following failed with a syntax error:
function caseSwitch($htype){
if($htype==22){
type22();
}
else{
if($htype==5){
type5();
} //I have tried adding a semicolon here and it still fails
}
else
{
_log("Whoops, Hierarchy Type " + $htype + " has not been automated yet");
}
}
This was a syntax issue. The solution was provided on the Sahi forum here:
http://sahi.co.in/forums/discussion/comment/16735#Comment_16735