Run Keyword
If '${Contains_True}' == 'true'
and
'${App_Name}' == 'App Name'
Accept_Confidential
ELSE IF '${Contains_True}' == 'true'
"Do Something" ELSE Log "Nothing"
In the below examples the different combinations are tested against a keyword that validates the combinations using the and/or validations. Please keep in mind that this kind of and/or check can also be separate ELSE IF statements.
*** Test Cases ***
TC
[Template] Validate App and Contains
App Name true
App Name false
My app Name true
My app Name false
Not My Name true
Not My Name false
*** Keywords ***
Validate App and Contains
[Arguments] ${App_Name} ${Contains_True}
Run Keyword If
... ('${Contains_True}'=='true' and '${App_Name}'=='App Name') or '${App_Name}'=='My app Name' Return From Keyword Accept
... ELSE IF '${Contains_True}'== 'true' Log App Name is not as expected:"${App_Name}" level=WARN console=${True}
... ELSE Fail Of the combo "${App_Name}"/"${Contains_True}" None of the values are correct.
Related
I would like to stop test suite execution in Katalon Studio when a test fails. Can someone tell me if this can be achieved in Katalon as I am new to this tool?
Expanding on this answer:
Create a Global Variable with boolean value set to false (You need to do this before actually running the test case/suite):
GlobalVariable.SKIP_REMAINING_TESTS = ''
Create a test listener with the following code
#BeforeTestCase
def sampleBeforeTestCase(TestCaseContext testCaseContext) {
if(GlobalVariable.SKIP_REMAINING_TESTS==true){
testCaseContext.skipThisTestCase()
println "Test Case skipped"
}
}
#AfterTestCase
def sampleAfterTestCase(TestCaseContext testCaseContext) {
if(testCaseContext.testCaseStatus=='FAILED'){
GlobalVariable.SKIP_REMAINING_TESTS = true
}
}
Before each test, #BeforeTestCase will check if GlobalVariable.SKIP_REMAINING_TESTS is true (it is false by default) and will skip the test if it is.
After each test, if the test case is failed it will change GlobalVariable.SKIP_REMAINING_TESTS to true and all subsequent test case in that test suite will be skipped.
I seem to be facing the general problem that directive driven mutations won't properly work when unit testing them. Using GraphQL Playground everything works as expected and the User model is auto detected. But if unit testing the same functionality it fails.
All config values are properly set (as I can see from regular requests not failing):
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => ClientName\PackageName\Models\User::class,
],
...
]
And lighthouse config values also set to the namespace above!
So for example this mutation would trigger the UserPolicy class and after that automatically call the create method of the User class:
type Mutation #protect(guards: ["api"]) {
"Create user"
createUser(data: NewUserInput! #spread): User
#can(ability: "create")
#create
}
But calling the same request via phpunit would result in errors:
for #can it returns a not authorized error and if I remove #can it only updates the email field of the user model as if mass assignment is not properly set.
When I now change the above schema definition to:
type Mutation #protect(guards: ["api"]) {
"Create user"
createUser(data: NewUserInput! #spread): User
#can(ability: "create" model: "ClientName\\PackageName\\Models\\User")
#create(model: "ClientName\\PackageName\\Models\\User")
}
And it works as expected within phpunit tests!
Now I suspect that within tests there is not User model found or not the appropriate but I cannot understand why this is.
Does anyone have any idea?
For some reason the following security rule is resolving to false when I try to write an object without the property that should be verified in .hasChild(newData.child('ownerId').val()). The property isn't mandatory, so I'm up to accept a write without it.
"pizza": {
"$pizzaId": {
".write": "root.child('users').hasChild(newData.child('ownerId').val()) || true"
}
}
Thus, I'm getting a PERMISSION_DENIED when running something like the code bellow:
firebase.database().ref(`pizza/peperoneID`).set({
extraPepe: true
});
I know that I can fix it by just going with (newData.child('ownerId').exists() && .hasChild(...)) || true but I'm really trying to understand why the first option isn't enough.
If there is no ownerId, you'll be passing null when you call hasChild.
That'll effect an error and that error will see your rule fail - so the trailing || true is ineffectual.
In my project i need to query from mongodb with the query having AND and OR, but i am getting error.
below is my code:
*** Variables ***
${host} mongodb://username:password#192.10.23.126/RegressionDB
${port} 27017
${mongDBName} RegressionDB
${mongoCollection} Service
${mQuery} { "service.offerings.offering.offeringType.masterCode": "Plan", $or: [ { "service.offerings.offering.offeringSubType.masterCode": "WS" }, { $and: [ { "service.isDeliveryRequired": "N" } ] } ] }
${mReturnFields} service.customerCode
${isReturnID} False
*** Test Cases ***
Query from MongoDatabase
Connect To MongoDB ${host} ${port}
${result}= Retrieve Mongodb Records With Desired Fields ${mongDBName} ${mongoCollection} ${mQuery} ${mReturnFields} ${isReturnID}
I got the following error:
ValueError: Expecting property name enclosed in double quotes: line 1 column 58 (char 57)
The same query i executed using MongoChef it worked fine, but not working with robot framework, what can be the reason.
The issue here is not related to AND and OR, I guess it has to do with setting properties! when you are setting properties, the values have to be in double quotes. Since it works for normal query and only throws this error for and/or so can you try add and/or in double quotes!
That should fix it!
Trying to use the .type action fails. This is on a web app using angular, not sure if this is related to it.
I can get assert attributes and existence of elements, but trying to use .type or .setValue fails
Here is the test
module.exports = {
'Smoke test app.ablio': function (test) {
test
.open('http://app.ablio.com')
.assert.title().is('ablio :: Communication Without Barriers', 'Title OK')
.open('https://app.ablio.com/signin')
.assert.attr('#sign-in', 'type', 'submit', "submit signin form exists")
.assert.exists('#username', "username form field exists")
.assert.attr('#username', 'type', 'text', "username form field is type text")
.assert.exists('#password', "password form field exists")
.assert.attr('#password', 'type', 'password',"password form field is type password")
.type('#username', 'testuser')
.assert.val('#username', 'testuser', 'Username was entered')
.screenshot ('shots/final.png')
.done();
}
};
the assert.val() fails:
Output:
dalek smoketest.js
Running tests
Running Browser: PhantomJS
OS: mac 10.10 (Yosemite) 32bit
Browser Version: 1.9.8
RUNNING TEST - "Smoke test app.ablio"
▶ OPEN http://app.ablio.com
✔ TITLE Title OK
▶ OPEN https://app.ablio.com/signin
✔ ATTRIBUTE submit signin form exists
✔ EXISTS username form field exists
✔ ATTRIBUTE username form field is type text
✔ EXISTS password form field exists
✔ ATTRIBUTE password form field is type password
▶ TYPE #username
✘ VAL
0 EXPECTED: testuser
0 FOUND:
0 MESSAGE: Username was entered
▶ SCREENSHOT shots/final.png
✘ TEST - "Smoke test app.ablio" FAILED
6/7 assertions passed. Elapsed Time: 8.55 sec
DalekJS CLI Tools Version: 0.0.5
DalekJS local install: 0.0.9
This resolves the issue and provides support for angular: http://gist.github.com/ryanzec/7546175
Scanned the DOM of the page & there you´ll see that you have 2 inputs with the id of username. That for one thing is invalid, and second, the username you´re are trying to fill is the 2nd in the DOM hierarchy. If it would be the first, it would even work, regardless of the invalid DOM.
I don't think that this is an Angular specific thing, as I have a hard time to believe that Angular itself would generate invalid DOM.