标签: testing

如果性能是一个非常重要的考虑因素,考虑c ++ 0x是否合适?

我写了一个简单的测试来检查c ++ 0x有多好.这是示例C++代码

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
#ifndef __GXX_EXPERIMENTAL_CXX0X__
 #define emplace_back push_back
 #define auto typeof(vs.begin())
#endif
int main()
{
 vector<string> vs;
 string s;
 while(cin>>s)
 {
  vs.emplace_back(s);
 }
 sort(vs.begin(),vs.end());
 for(auto it = vs.begin();it != vs.end();++it)
 {
  cout << (*it) << endl;
 }
 return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是一个运行它的脚本

#!/bin/bash

inputFile=`mktemp`;
outputFile1=`mktemp`
outputFile2=`mktemp`

cat /dev/urandom | base64 > $inputFile 2> /dev/null &

echo "Generating Sample Input.. ${1:-10} seconds"
sleep ${1:-10}

export TOKILL=`pgrep -P $$ cat`
$(kill $TOKILL) …
Run Code Online (Sandbox Code Playgroud)

c++ testing c++11

-1
推荐指数
2
解决办法
525
查看次数

如何将大型ipas分发给beta测试人员?

我正在开发一个非常大的(20 + MB压缩)iPhone应用程序.我一直在通过电子邮件发送构建版本,但随着新图像和其他媒体的进入,其大小一直在上升 - 我的一些测试人员的电子邮件提供商拒绝接收构建的消息由于尺寸过大.

这是什么标准解决方案?有没有标准的解决方案?我曾考虑使用Dropbox,但不想强迫我的测试人员安装它.我能想到的唯一选择是建立一个FTP服务器,这听起来像一个涉及的项目.

iphone testing ios

-1
推荐指数
1
解决办法
177
查看次数

你能在同一个junit测试中有多个assertEquals(答案,结果)吗?

为任务做一些junit测试.只是想知道在同一个测试中是否可以有多个assertEquals()语句?当它通过时,这是否意味着如果一个assertEquals语句失败将会失败?或者只需要一个assertEquals()语句?

    car3 = new Car("gargle", 45, false);
    car4 = new Car("cheese", 45, true);
    moto3 = new MotorCycle("ass", 45);

    assertEquals(true, carPark.spacesAvailable(car3));
    assertEquals(true, carPark.spacesAvailable(car4));
    assertEquals(true, carPark.spacesAvailable(moto3));
Run Code Online (Sandbox Code Playgroud)

只会使用第一个assertEquals或将全部使用

java testing junit

-1
推荐指数
1
解决办法
8043
查看次数

如何使用Junit和Mockito测试Spring验证器

我有一个Spring Validator:

@Component
public class AddClientAccountValidator implements Validator {

    @Autowired
    private ValidatorUtils validatorUtils;

    @Override
    public boolean supports(Class<?> clazz) {
        return UserDto.class.equals(clazz);
    }

    @Override
    public void validate(Object target, Errors errors) {
        UserDto user = (UserDto) target;
        validatorUtils.setParam(errors, user);

        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "username", "username.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "password.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "confirmPassword",
                "confirmPassword.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstName", "firstName.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lastName", "lastName.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "personalId", "personalId.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "city", "city.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "address", "address.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email", "email.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "phone", "phone.required");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "contribution", "contribution.required");

        validatorUtils.validateAddClientAccount();
    }
}
Run Code Online (Sandbox Code Playgroud)

在上面的Validator中有注入ValidatorUtils类:

@Component
class ValidatorUtils {

    @Autowired
    private …
Run Code Online (Sandbox Code Playgroud)

testing junit spring mockito

-1
推荐指数
1
解决办法
7828
查看次数

获取错误:找到参数'--webdriver-port',这是不期望的,或者在此上下文中无效

当我运行我的selenium代码时,我收到错误"错误:找到参数'--webdriver-port'这是不期望的,或者在此上下文中无效"

我正在使用Firefox 48.0使用gecko驱动程序我已经初始化了浏览器.并得到上述错误.

java testing selenium firefox-marionette geckodriver

-1
推荐指数
1
解决办法
1020
查看次数

使用arc4random生成随机数以添加到字符串以进行UI测试登录xcode UI测试

我正在测试注册应用程序,使用xcode UI测试我想知道如何使用arc4random生成一个随机数,将被输入到应用程序?

这是我的代码,但得到一个类型canont将类型为UInt32的值转换为预期的参数类型字符串.

 let emailBox = self.app.textFields["Email"]
    if emailBox.exists {enter code here
        emailBox.tap()
        emailBox.typeText("testing" + arc4random() + "gmail.com")
    }
Run Code Online (Sandbox Code Playgroud)

testing xcode arc4random ios xcode-ui-testing

-1
推荐指数
1
解决办法
274
查看次数

类型错误:__init__() 缺少 1 个必需的位置参数:“app_module”

我尝试在我的网站上运行测试,但收到此错误消息。想知道是否有其他人有这方面的经验。可能与 Django 框架有关。

TypeError: __init__() missing 1 required positional argument: 'app_module'
Run Code Online (Sandbox Code Playgroud)

testing django error-handling

-1
推荐指数
1
解决办法
1646
查看次数

我们可以用 Promise 替换 Async/Await

我们可以在下面的代码中使用 Promise 而不是 async/await 吗?


fixture`MyFixture`.page`http://devexpress.github.io/testcafe/example`;

test("My first test", async t => {
  await t
    .typeText("#developer-name", "srikanth chitla")
    .setTestSpeed(0.1)
    .click("#submit-button");
});
Run Code Online (Sandbox Code Playgroud)

javascript testing promise async-await testcafe

-1
推荐指数
1
解决办法
1467
查看次数

单元测试 xunit 以下构造函数参数没有匹配的夹具数据

以下构造函数参数没有用于使用 moq 和 xunit 进行单元测试的匹配装置数据。

已经使用依赖注入和模拟来测试类。

//this is how i register the DI.
services.AddScoped<IWaktuSolatServiceApi, WaktuSolatServiceApi>(); 


 public interface IWaktuSolatServiceApi
 {
    Task<Solat> GetAsyncSet();
 }


// the unit test. 
public class UnitTest1 
{
    Mock<IWaktuSolatServiceApi> waktu;

    public UnitTest1(IWaktuSolatServiceApi waktu)
    {
        this.waktu = new Mock<IWaktuSolatServiceApi>();
    }

    [Fact]
    public async Task ShoudReturn()
    {
        var request = new Solat
        {
            zone = "lala"
        };

        var response = waktu.Setup(x => 
        x.GetAsyncSet()).Returns(Task.FromResult(request));
    }
}
Run Code Online (Sandbox Code Playgroud)

但是我收到此错误以下构造函数参数没有匹配的夹具数据。

c# testing moq xunit

-1
推荐指数
1
解决办法
2153
查看次数

Javascript测试结果.任何人都能解释一下吗

我最近写了一篇博文,关于在绑定事件处理程序之前检查jquery元素是否存在,我做了一个快速的jsfiddle ,你可以在这里看到

我不明白的是,结果显示(使用chrome以微秒为单位测量)测试2比测试1快很多.

您将从jsfiddle看到测试2在绑定click事件之前检查匹配是否存在

测试1是:

console.time('time_1');
    $('.yep').click(function() {
      alert('clicked');
    });
    console.timeEnd('time_1'); 
Run Code Online (Sandbox Code Playgroud)

测试1只是试图绑定事件

测试2:

console.time('time_2');
if ($('.yep').length) {
  $('.yep').click(function() {
    alert('clicked');
  });
}
console.timeEnd('time_2');
Run Code Online (Sandbox Code Playgroud)

测试2在绑定之前检查元素是否存在.

我在一些代码上运行两位代码,87我认为'elemenets',其中一个有'yep'类

我真的不明白为什么第二次测试更快,因为它做了更多的工作.

结果:

time_1: 0.856ms 
time_2: 0.146ms 
Run Code Online (Sandbox Code Playgroud)

任何人都可以解决一些混乱的开发人员.

谢谢

请不要用jquery中绑定点击事件的替代方法回复,.click只是用作一个简单的测试

javascript testing optimization jquery

-2
推荐指数
1
解决办法
102
查看次数