标签: testing

C 编程语言中的严格交替(来自 Tanenbaum)

为什么进程0的第一个入口不严格交替测试 while (turn == 0) //then Enter 进程0怎么能进入 while (turn != 0),这和 while (turn != 0) 不一样吗== 1) ?

turn = 0;
//process 0 to enter
while (TRUE) {
  while (turn != 0)
    critical_region();
  turn = 1;
  noncritical_region();
}

//process 1 to enter
while (TRUE) {
  while (turn != 1)
    critical_region();
  turn = 0;
  noncritical_region();
}
Run Code Online (Sandbox Code Playgroud)

c testing synchronization

0
推荐指数
1
解决办法
3991
查看次数

如何创建使用特定 JVM 参数运行的 Spring Boot 测试

我想为使用特定 JVM 参数的 Spring Boot 应用程序创建一个测试,我希望 JVM 参数仅用于此测试。

这可能吗 ?我的目标是为一个测试设置一个代理,所以如果有另一种方法来实现这一点,请提出建议。

java testing spring jvm spring-boot

0
推荐指数
1
解决办法
2632
查看次数

如何通过 AWS 控制台阻止 AWS Lamba 测试?

我在生产中有一个 AWS Lambda 函数。触发它可以导致货币交易。我想阻止通过 AWS 控制台测试此 lambda 的功能,以便具有控制台访问权限的用户不会意外触发它,以便他们可以在相应的登台 lambda 上进行测试。它以某种方式可能吗?

testing amazon-web-services aws-lambda

0
推荐指数
1
解决办法
37
查看次数

编写 login() 函数的最终黄金标准是什么?

我在网上搜索最终的“登录模式”,其中包括登录实际成功的验证。问题 -根据我们在团队中决定的 DRY 和编码约定,我们不允许在 Pagemodels 中使用expect(又名断言)。这是当前的登录方法,有时仍然不稳定。我想问你亲爱的 Automators,你是如何设计包括验证在内的登录的?

/**
 * Actual login function
 */
async performLogin(): Promise<void> {
   console.log(`perform login`);
   await t
   .typeText(this.Email, username, {
      replace: true,
      paste: true
   })
   .typeText(this.Password, password, {
      replace: true,
      paste: true
   })
   .click(this.buttonSignIn)
}

/**
 * Login validation
 */
async login(): Promise<void> {
   await t.wait(7000)
   const getURL: any = ClientFunction(() => window.location.href)
   let currentURL: string = await getURL()

   while (currentURL === basePM.urlLogin) {
      this.performLogin()
      await t.eval(() => location.reload(true))
      currentURL = await getURL()
   } …
Run Code Online (Sandbox Code Playgroud)

javascript authentication testing automation testcafe

0
推荐指数
1
解决办法
87
查看次数

使用 TestCafe 发出真实的 HTTP 请求

由于严格通过前端自动化我们工作流程的某些部分的复杂性,我们需要在前端自动化测试运行之前发出 HTTP 请求以设置测试数据。

使用 TestCafe 文档,我尝试将一些东西拼凑在一起,当测试运行时,http 请求没有得到执行。这是我的代码:

import {Selector, ClientFunction, RequestHook, RequestLogger} from 'testcafe';
import https from 'https';


fixture `Call Create Test Move`
    .before(async ctx => {
        test('test', async t => {
            const executeRequest = () => {
                return new Promise(resolve => {
                    const options = {
                        method: 'POST',
                        uri: 'https://api.com/move/sample',
                        headers: {
                            "X-Company-Secret": "xxxxxxx",
                            "X-Permanent-Access-Token": "xxxxxxx"
                        },
                        body: {
                            companyKey: 'xxxxxx'
                        },
                        json: true
                    };

                    const req = https.request(options, res => {
                        console.log('statusCode:', res.statusCode);
                        console.log('headers:', res.headers);
                        resolve();
                    });

                    req.on('error', …
Run Code Online (Sandbox Code Playgroud)

javascript testing automated-tests e2e-testing testcafe

0
推荐指数
1
解决办法
1458
查看次数

使用 lodash 从数组中查找子字符串并将它们推送到另一个,然后将结果与第三个表进行比较

我有数组:

all [a,b,ac,d, A]
Run Code Online (Sandbox Code Playgroud)

我想在这个中找到包含子字符串“a”(“A”)的所有元素,使用来自 lodash 的过滤器并将它们推送到另一个 - 到 filterTab

   const item = "a"
Run Code Online (Sandbox Code Playgroud)

我尝试这样:

import { some, method, differenceWith, isEquel } from 'lodash';
const filterTab = [];

filterTab.push (some(all, method('match',/item/i)));
Run Code Online (Sandbox Code Playgroud)

但它不起作用。

下一步如果它有效 - 它将是这样的:

var dif = differenceWith(filterTab, array3, _.isEqual);
Run Code Online (Sandbox Code Playgroud)

我不知道为什么它不起作用......

javascript testing lodash e2e-testing testcafe

0
推荐指数
1
解决办法
77
查看次数

Flutter Firebase 身份验证模拟器启用

我正在尝试将Firebase 身份验证模拟器连接到我的 Flutter 移动项目以执行一些本地测试。不幸的是,似乎无法使用FlutterFire 插件

启用FirestoreCloud Functions模拟器没有任何问题,但我找不到身份验证的方法。

有人有想法或最佳实践可以遵循吗?

testing firebase-authentication flutter firebase-cli

0
推荐指数
1
解决办法
2380
查看次数

TestCafe:.navigateTo 方法访问的 URL 长度有限制吗?

在某种情况下,当访问的页面具有超过 4k 个字符的 url 时,测试会冻结。在开发工具控制台中,我收到一些与 testcafe 中的一些 .js 文件相关的错误 (500),例如 task.js。如果我将 url 拆分为少于 3k 个字符,它就可以工作。这可以从一些配置文件中更改吗?谢谢。

javascript testing automated-tests browser-automation testcafe

0
推荐指数
1
解决办法
54
查看次数

在 Java 中为测试创建 UUID 列表

我想生成一个模拟List<UUID>并使用随机 UUID 填充它。但是,我不确定通过创建列表和添加项目是否有更合适的方法而不是以下方法。

List<UUID> uuidList = new ArrayList<>();
uuidList.add(UUID.randomUUID());
uuidList.add(UUID.randomUUID());
uuidList.add(UUID.randomUUID());
Run Code Online (Sandbox Code Playgroud)

那么,有没有更好的办法呢?

java testing junit unit-testing mocking

0
推荐指数
1
解决办法
38
查看次数

尽管有测试功能,为什么我还是“没有测试要运行”?

新手来这里,我写了一个简单的 main_test.go 文件来运行 main.go 的一些测试用例,当我运行go test它时说 testing:warning: no tests to run PASS ok Solution 0.878s

我的 main.go:

package main

func normalizePhoneNum(phoneNumber string) string {
    return ""
}

func main() {

}
Run Code Online (Sandbox Code Playgroud)

main_test.go:

package main

import (
    "testing"
)

func testNormalizePhoneNum(t *testing.T) {
    testCase := []struct {
        input  string
        output string
    }{
        {"1234567890", "1234567890"},
        {"123 456 7891", "123 456 7891"},
        {"(123) 456 7892", "(123) 456 7892"},
        {"(123) 456-7893", "(123) 456-7893"},
        {"123-456-7894", "123-456-7894"},
        {"123-456-7890", "123-456-7890"},
        {"1234567892", "1234567892"},
        {"(123)456-7892", "(123)456-7892"},
    } …
Run Code Online (Sandbox Code Playgroud)

testing go

0
推荐指数
1
解决办法
79
查看次数