Development

Contrastive learning typically matches pairs of related views among a number of unrelated negative views. Views can be generated (e.g.…

This is my code,
”’
import time

from selenium.webdriver.common.by import By

from selenium.webdriver import ActionChains

from selenium.webdriver.support import expected_conditions as EC

from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
num = str(datetime.datetime.now())
driver = webdriver.Firefox(executable_path=”C:\geckodriver.exe”)
driver.get(“https://my.eventbuizz.com/_super/analytics_requests”)
driver.maximize_window()
time.sleep(4)
driver.find_element_by_name(“email”).send_keys(“text”)
driver.find_element_by_name(“password”).send_keys(“text”)
driver.find_element_by_xpath(“//input[@value=’login’]”).click()
time.sleep(5)
driver.find_element_by_xpath(“//span[contains(text(),’Google Analytics’)]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//span[contains(text(),’Analytics Requests’)]”).click()
ActionChains = ActionChains(driver)
time.sleep(2)

lists = driver.find_elements_by_xpath(“//*[@class= ‘gradeA’]/td[1]”)
for list_item in lists:
print(len(lists))
print(type(lists))
print(list_item.text)
output = list_item.text

driver.execute_script(“window.open(”);”)
driver.switch_to.window(driver.window_handles[1])
time.sleep(2)
driver.get(“https://my.eventbuizz.com/_super/organizerEvent/organizerEventList”)
time.sleep(2)
driver.find_element_by_xpath(“//input[@id=’event_name’]”).send_keys(output)
time.sleep(2)
driver.find_element_by_xpath(“//input[@value=’Search’]”).click()
time.sleep(2)
time.sleep(3)
driver.find_element_by_xpath(“//a[normalize-space()=’Auto Login’]”).click()
time.sleep(5)

driver.switch_to.window(driver.window_handles[2])
time.sleep(4)
driver.find_element_by_xpath(“//input[@name=’searchText’]”).send_keys(output)
driver.find_element_by_xpath(“//input[@id=’btn_sbt’]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//div[@class=’img-center’]//a”).click()
time.sleep(3)
event_name = driver.find_element_by_xpath(“//input[@id=’event_name’]”).get_attribute(‘value’)
print(“Event Name = ” + event_name)
time.sleep(5)
a = driver.find_element_by_xpath(“//body[1]/section[1]/section[1]/form[1]/div[1]/div[3]/div[3]/div[2]/em[1]”).text
ab = a[8:]
print(“Event URl = ” + ab)

driver.execute_script(“window.open(”);”)
driver.switch_to.window(driver.window_handles[3])
time.sleep(2)
driver.get(“https://analytics.google.com/analytics/web/#/a213435779w295029133p256179771/admin”)
time.sleep(4)
email_phone = driver.find_element_by_xpath(“//input[@id=’identifierId’]”)
time.sleep(2)
email_phone.send_keys(“eb.march.eventbuizz2021@gmail.com”)
driver.find_element_by_id(“identifierNext”).click()
password = WebDriverWait(driver, 5).until(
EC.element_to_be_clickable((By.XPATH, “//input[@name=’password’]”)))
password.send_keys(“text”)
driver.find_element_by_id(“passwordNext”).click()
time.sleep(20)
# driver.find_element_by_xpath(“//span[@class=’ga-dialog-title-close’]”).click()
# time.sleep(6)
driver.find_element_by_xpath(“//span[contains(text(),’Create Property’)]”).click()
time.sleep(4)
driver.find_element_by_xpath(“//input[@id=’name’]”).click()
time.sleep(4)
driver.find_element_by_xpath(“//input[@id=’name’]”).send_keys(event_name)
time.sleep(4)

countries = driver.find_elements_by_css_selector(“[class=’menu-open-button-label-text’]”)
for country in countries:
if country.text == “United Kingdom”:
country.click()
break
time.sleep(2)
country_name = driver.find_elements_by_css_selector(“[class=’option-container ng-star-inserted’]”)
for count in country_name:
if count.text == “Denmark”:
count.click()
break

time.sleep(2)
amount_code = driver.find_elements_by_xpath(“//div[@class=’option-item-wrapper ng-star-inserted’]”)
for code in amount_code:
if code.text == “Danish Krone (DKK DKK)”:
code.click()
break

time.sleep(2)
driver.find_element_by_xpath(“//span[contains(text(),’Show advanced options’)]”).click()
time.sleep(2)
driver.find_element_by_css_selector(“[class=’mat-slide-toggle-thumb’]”).click()
time.sleep(2)
end = driver.find_element_by_xpath(“//label[contains(text(),’Website URL’)]”)
driver.execute_script(“document.body.scrollIntoView();”, end)
time.sleep(2)
driver.find_element_by_xpath(“//input[@type=’url’]”).send_keys(ab)

driver.find_element_by_xpath(“//label[@for=’mat-radio-8-input’]//span[@class=’mat-radio-label-content’]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//span[contains(text(),’Next’)]”).click()
time.sleep(2)

driver.find_element_by_xpath(“//label[@for=’mat-radio-2-input’]//span[@class=’mat-radio-label-content’]”).click()

time.sleep(3)
driver.find_element_by_xpath(“//label[@for=’mat-checkbox-2-input’]//span[@class=’mat-checkbox-inner-container’]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//span[normalize-space()=’Create’]”).click()
time.sleep(20)
driver.switch_to.frame(“galaxyIframe”)
time.sleep(5)
track = driver.find_element_by_xpath(“//div[@class=’_GACjb’]”).text
print(print(“Tracking ID = ” + track))

driver.switch_to.default_content()
time.sleep(2)
driver.find_element_by_xpath(“//mat-icon[contains(text(),’arrow_back’)]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//span[contains(text(),’View Access Management’)]”).click()
time.sleep(8)
driver.find_element_by_xpath(“//button[@aria-label=’Add access to new users’]//span[@class=’mat-button-wrapper’]”).click()
time.sleep(3)
driver.find_element_by_xpath(“//button[normalize-space()=’Add users’]”).click()
time.sleep(3)
driver.find_element_by_id(“mat-chip-list-input-0”).send_keys(
“analytics47@api-project-770804776074.iam.gserviceaccount.com”)
time.sleep(3)
driver.find_element_by_xpath(“//span[normalize-space()=’Add’]”).click()
time.sleep(5)
driver.find_element_by_xpath(“//mat-icon[normalize-space()=’close’]”).click()
time.sleep(3)
driver.find_element_by_xpath(“//span[contains(text(),’View Settings’)]”).click()
time.sleep(3)
view_id = driver.find_element_by_css_selector(“[class=’content view-id’]”).text
print(“View ID =” + view_id)
time.sleep(3)
driver.execute_script(“window.open(”);”)
driver.switch_to.window(driver.window_handles[4])
time.sleep(2)
driver.get(“https://my.eventbuizz.com/_admin/add_google_analytics”)
time.sleep(4)
driver.find_element_by_xpath(“//input[@placeholder=’Google analytics email’]”).clear()
time.sleep(2)
driver.find_element_by_xpath(“//input[@placeholder=’Google analytics email’]”).send_keys(
” analytics47@api-project-770804776074.iam.gserviceaccount.com”)
time.sleep(1)
driver.find_element_by_xpath(“//input[@placeholder=’Google Analytics Code’]”).clear()
time.sleep(2)
driver.find_element_by_xpath(“//input[@placeholder=’Google Analytics Code’]”).send_keys(track)
time.sleep(1)
driver.find_element_by_xpath(“//input[@placeholder=’Google profile ID’]”).clear()
time.sleep(2)
driver.find_element_by_xpath(“//input[@placeholder=’Google profile ID’]”).send_keys(view_id)
time.sleep(2)
driver.find_element_by_xpath(“//input[@class=’save-event’]”).click()
time.sleep(4)
driver.find_element_by_xpath(“//a[@class=’btn btn-sm log-out text-right’]”).click()
time.sleep(3)
driver.switch_to.window(driver.window_handles[5])
time.sleep(4)
driver.find_element_by_xpath(“//label[normalize-space()=’Statistics’]”).click()
time.sleep(2)
driver.find_element_by_xpath(“//a[normalize-space()=’Accept all cookies’]”).click()

time.sleep(5)
driver.switch_to.window(driver.window_handles[3])
driver.find_element_by_xpath(“//md-icon[@md-font-icon=’realtime-icon’]”).click()
time.sleep(3)
driver.find_element_by_xpath(“//span[@class=’ga-nav-link-label ga-nav-link-no-icon’]”).click()
time.sleep(3)
print(“************************ Google analytics added successfully **************************** “)

with open(‘Text.txt’, mode=’w’) as f:
f.write(“Event_name” + ” ” + “Event_Tracking_ID” + “n”)
for post in event_name:
f.write(post)
f.write(” “)
for post1 in track:
f.write(post1)
f.write(“n”)
driver.switch_to.window(driver.window_handles[0])
”’

I have a multi module application “Project A”. This application is hosted in clustered app nodes using tomcat as web server. We are using Spring, Web Services as primary among many other technologies to build this.

For doing the API Automation i have another project “Project B” which test all the public API of “Project A” using rest-assured.

Both the “Project A” and “Project B” are distinctly different and hosted in different GIT location. We do the build and test using Jenkins.

Now my requirement is to get code coverage of “Project A” using “Project B”.

What I have Done till now:

A. I have installed jacoco-agent.jar in each of my app node and put the “JACOCO-ARGS” in the web server start up script.

JACOCO_OPTS=”-javaagent:/opt/itop/jacoco-agent.jar=destfile=/opt/itop/jacoco-
it.exec,output=file,append=true,jmx=true”

JAVA_OPTS=”${JAVA_OPTS} ${JACOCO_OPTS}”

B. We usually keep one node on only while looking for code coverage.

What I am getting now:

I am getting the jacoco-it.exec file generated but with very less coverage. With all the API passing i am getting only 3% coverage at max. Where as by doing manual testing we are getting more than 50%.

What I am looking for:

Is there any other step which I am missing here?
How to get max code coverage for this set up?
What is the standard I need to follow while looking for code coverage?

White box testing is essential in software engineering, offering an in-depth view of internal code operations to enhance software quality and stability. This blog outlines the various types of white box testing, their importance in identifying and fixing code errors early in the development process, and the latest tools for 2024, such as JUnit and Selenium. White box testing ensures comprehensive code coverage and supports the development of robust, efficient applications by allowing detailed inspection and modification of the code.
The post Why is White Box Testing Essential in Software Engineering? first appeared on TestingXperts.

I am currently working on updating regression test suite. I would like to add some simple test at the beginning of the regression suite to make sure it is still behaving correctly and all the basic functionality still works (can perform basic operations and also it is able to connect to the database or other services) before proceed with full regression test suite. These test would not be specialized based on type of changes which were made to the software, but would only cover specific subset of regression tests, which would be the same for every new build. They would cover broad range of functionality. Would these test be considered more as sanity tests or smoke tests? Thank you.