How to solve runing error in Groovy Script - testing

I have tried to get the property value, where I have saved in the project-properties.
This is the code which I have tried out.log.info wasn't working fine ,but when I run the code separately(that means only first line..), It shows the valid answer in a popup.
def ProjectProp = testRunner.testCase.testSuite.project.getPropertyValue("Name")
log.info {"Project Property = "+ProjectProp}
I am new to SoapUI.I would be really grateful, If you will be able to help me out to find a solution for the error which i received as follows,
INFO:Script13$_run_closure1#1d32637

Your problem is unrelated to SoapUI. You obviously have difficulty with basic Groovy syntax. Seek some tutorial on Groovy.
Your specific case, should read:
def projectProp = testRunner.testCase.testSuite.project.getPropertyValue("Name")
log.info("Project Property = " + $projectProp)

Related

Issues pulling change log using python

I am trying to query and pull changelog details using python.
The below code returns the list of issues in the project.
issued = jira.search_issues('project= proj_a', maxResults=5)
for issue in issued:
print(issue)
I am trying to pass values obtained in the issue above
issues = jira.issue(issue,expand='changelog')
changelog = issues.changelog
projects = jira.project(project)
I get the below error on trying the above:
JIRAError: JiraError HTTP 404 url: https://abc.atlassian.net/rest/api/2/issue/issue?expand=changelog
text: Issue does not exist or you do not have permission to see it.
Could anyone advise as to where am I going wrong or what permissions do I need.
Please note, if I pass a specific issue_id in the above code it works just fine but I am trying to pass a list of issue_id
You can already receive all the changelog data in the search_issues() method so you don't have to get the changelog by iterating over each issue and making another API call for each issue. Check out the code below for examples on how to work with the changelog.
issues = jira.search_issues('project= proj_a', maxResults=5, expand='changelog')
for issue in issues:
print(f"Changes from issue: {issue.key} {issue.fields.summary}")
print(f"Number of Changelog entries found: {issue.changelog.total}") # number of changelog entries (careful, each entry can have multiple field changes)
for history in issue.changelog.histories:
print(f"Author: {history.author}") # person who did the change
print(f"Timestamp: {history.created}") # when did the change happen?
print("\nListing all items that changed:")
for item in history.items:
print(f"Field name: {item.field}") # field to which the change happened
print(f"Changed to: {item.toString}") # new value, item.to might be better in some cases depending on your needs.
print(f"Changed from: {item.fromString}") # old value, item.from might be better in some cases depending on your needs.
print()
print()
Just to explain what you did wrong before when iterating over each issue: you have to use the issue.key, not the issue-resource itself. When you simply pass the issue, it won't be handled correctly as a parameter in jira.issue(). Instead, pass issue.key:
for issue in issues:
print(issue.key)
myIssue = jira.issue(issue.key, expand='changelog')

Getting FusionAuthClient is not a constructor error

I am trying the fusionauth-node-client and following the wiki https://fusionauth.io/docs/v1/tech/client-libraries/node. But I am getting the following error
const client = new FusionAuthClient('6b87a398-39f2-4692-927b-13188a81a9a3', 'http://localhost:9011');
^
TypeError: FusionAuthClient is not a constructor
at Object.<anonymous>
I have pasted the exact code mentioned in the doc still it is not working. Can anyone help me in identifying what I am missing here.
I dug around in the library and noticed that we are exporting several objects and our example is no longer correct.
To get the client you need to change your syntax a little bit to get the correct object.
const {FusionAuthClient} = require('fusionauth-node-client');
This translates to: require the library fusionauth-node-client and give me the FusionAuthClient from inside it. There are also a RESTClient and JWTManager available in the library but you shouldn't need either of those to code with FusionAuth.
I will also update our example to correct this discrepancy.

Chef Data Bags and dynamic variable passing

I am trying to figure out a way to get the below code work; I have tried various methods but the chef-client run breaks at the 3rd line.
lsf = "#{node[:env]}"+"_ls"
dsf = "#{node[:env]}"+"_ds"
dsTemplateBag = data_bag_item('configTemplates', "#{dsf}")
lcTemplateBag = data_bag_item('configTemplates', "#{lsf}")
However on another test recipe I was able to successfully get the following working:
env = "test"
dsTemplateBag = data_bag_item('configTemplates', "#{env}")
I am quite new to Chef and please can someone advise me on how to get this working ?
After a little bit debugging I realised there was a typo preventing the data bag to be properly used; hence issue.
dsTemplateBag = data_bag_item('configTemplates', "#{node[:env]}_ls")
this worked for me. And as Tensibai suggested in the above comment mixing concatenation and interpolation is not a good practice (I was desperate to make it work! In my defense).

FileUploadDialogHandler()

I am trying to automate a web app which involves selecting an existing file using a fileuploaddialoghandler() method and entering the full path in the file name dropdown then Open click.
However, when I attempt this using this code
FileUploadDialogHandler fileupload = new FileUploadDialogHandler(#"C:\TIFFiles\Testtif.TIF");
//browser.WaitForComplete();
using (new UseDialogOnce(browser.DialogWatcher, fileupload))
{
newIee.Button(Find.ById("ctl00_WebPartManager1_FileUpload_FileBrowse")).ClickNoWait();
browser.AddDialogHandler(fileupload);
browser.WaitForComplete();
browser.RemoveDialogHandler(fileupload);
}
It does not work.
What else should I be doing?
Thanks much!
W
I just have one question about your code... What is newIee? I can't tell by looking at the code if newIee is attached to browser. Other than that, your FileUpdateDialogHandler should be fine.
If you can provide the code where you declare newIee, it might add me in determining if it's a factor causing your code not to work properly.

selenium.captureEntirePageScreenshot does not work but selenium.captureScreenshot works

I'm running Selenium with TestNG using Eclipse and Selenium RC. I used the command:
selenium.captureEntirePageScreenshot("\\test.png","");
but got the following error:
com.thoughtworks.selenium.SeleniumException: ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window. The error message is: Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]
Can someone please suggest why this error is occuring? I have already tried the following:
1)Replaced "" (String kwargs parameter) with "background=#CCFFDD"
2)Running in Firefox in chrome mode
3)Changed the path to the following values and I'm still getting the error:
"\test.jpg",
"c:\test.jpg",
"c:\test.png",
"c:\folder1\test.png", (folder1 exists)
"c:\folder1\test.jpg",
4)Tried with - selenium.captureScreenshot("\test.png"); and it works fine but it does not solve my purpose and I dont want to use awt.
Can someone please suggest what could be wrong?
Thanks,
Mugen
Better yet...
I ran into a similar issue, where I only had access to a relative path instead of an absolute one. Here is the solution I came up with:
public void saveScreenshot(String methodName) {
if (methodName == null) {
methodName = String.valueOf(System.currentTimeMillis());
}
File f = new File("reports" + File.separator + methodName + ".jpg");
selenium.captureEntirePageScreenshot(f.getAbsolutePath(), "");
}
Which will put a screen shot of the entire page into the reports directory that is relative to the project. I am using the method name as the file name, or the current time if null is sent to the method.
Try this:
String path = System.getProperty("user.dir");
selenium.captureEntirePageScreenshot(path + "\\test.png", "");
To whomsoever it may concern,. the problem was solved after I kept fiddling with the code for a while and restarted my system. I came to know that captureEntirePageScreenshot works only on absolute paths so I made sure I kept trying with just that.
I got it working after looking at this page.
http://ashishbhatt.wordpress.com/2010/02/03/using-captureentirepagescreenshot-with-selenium/